-
Notifications
You must be signed in to change notification settings - Fork 670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make math.Add64 and math.Mul64 generic #3205
Conversation
// Deprecated: Add64 is deprecated. Use Add[uint64] instead. | ||
Add64 = Add[uint64] | ||
|
||
// Deprecated: Mul64 is deprecated. Use Mul[uint64] instead. | ||
Mul64 = Mul[uint64] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are used by coreth. I was too lazy to make a PR to update the dependency with this. We should remove these once coreth has removed their usage.
require := require.New(t) | ||
|
||
sum, err := Add64(0, maxUint64) | ||
require.Equal(uint(math.MaxUint), MaxUint[uint]()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert
s throughout. And the bike shed should be purple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avalanchego uses require
exclusively - not going to bring that convo into this PR haha
Why this should be merged
Resolves the asymmetry between
math.Sub
andmath.Add64
/math.Mul64
.How this works
^uint(0) == maxUint
How this was tested