-
Notifications
You must be signed in to change notification settings - Fork 253
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
Support for more backends #797
base: master
Are you sure you want to change the base?
Conversation
} | ||
|
||
pub(super) const fn mul_without_cond_subtract(mut self, other: &Self) -> (bool, Self) { | ||
let (mut lo, mut hi) = ([0u64; N], [0u64; N]); |
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.
Why not using the MulBuffer
helper here for an easier manipulation?
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.
Good question, it's been a while since I looked at this code =)
This is the basically tackling #769 (comment) right? |
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.
Looks good, just some minor comments
// We compute this as follows. | ||
// First, MODULUS mod 2^64 is just the lower 64 bits of MODULUS. | ||
// Hence MODULUS mod 2^64 = MODULUS.0[0] mod 2^64. | ||
// |
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.
As a follow-up to this PR, the next step would be to rename this existing BigInt
to BigInt64
, and then also add a BigInt32
, correct?
/// Does the modulus have a spare unused bit (i.e., the MSB is 0) | ||
/// | ||
/// This condition applies if | ||
/// (a) `Self::MODULUS[N-1] >> 63 == 0` |
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.
The comment Self::MODULUS[N-1] >> 63 == 0
would (later) need to be changed to reflect that the underlying representation might be other than an array of u64
s.
|
||
/// (MODULUS + 1) / 4 when MODULUS % 4 == 3. Used for square root precomputations. | ||
/// | ||
/// Can be computed if the `BigInt` type has a `plus_one_div_four` method. |
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.
And otherwise?
Do you mean if plus_one_div_four
returns Some(...)
?
Description
closes: #XXXX
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
Pending
section inCHANGELOG.md
Files changed
in the GitHub PR explorer