-
Notifications
You must be signed in to change notification settings - Fork 85
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
Ternary big integers common parts #102
Ternary big integers common parts #102
Conversation
|
||
impl OverflowingAdd for u32 { | ||
fn overflowing_add_with_carry(self, other: Self, carry: Self) -> (Self, bool) { | ||
let (sum, first_overflow) = self.overflowing_add(other); |
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.
I'm not entirely sure what the purpose of this code is, could you explain? I see that there's an add-plus-carry but I'm not sure what context this all might be useful in.
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.
I am not the author of the code but I'll try to explain.
When dealing with big integers you have a lot of carry propagation to handle. This piece of code is just an extension of the overflowing add with a carry. It could technically be done without this function but this is just to DRY things I assume.
Description of change
Adds common parts of ternary big integers.
Links to any relevant issues
Part of #77
Change checklist
Tick the boxes that are relevant to your changes, and delete any items that are not.