Skip to content
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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

Pratyush
Copy link
Member

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.

  • Targeted PR against correct branch (master)
  • Linked to GitHub issue with discussion and accepted design OR have an explanation in the PR that describes this work.
  • Wrote unit tests
  • Updated relevant documentation in the code
  • Added a relevant changelog entry to the Pending section in CHANGELOG.md
  • Re-reviewed Files changed in the GitHub PR explorer

@Pratyush Pratyush requested review from a team as code owners February 27, 2024 15:50
@Pratyush Pratyush requested review from z-tech, mmagician and weikengchen and removed request for a team February 27, 2024 15:50
}

pub(super) const fn mul_without_cond_subtract(mut self, other: &Self) -> (bool, Self) {
let (mut lo, mut hi) = ([0u64; N], [0u64; N]);
Copy link
Contributor

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?

Copy link
Member Author

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 =)

ff/src/fields/models/fp/montgomery/backend.rs Show resolved Hide resolved
@mmagician
Copy link
Member

mmagician commented Mar 6, 2024

This is the basically tackling #769 (comment) right?

Copy link
Member

@mmagician mmagician left a 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

Comment on lines +295 to +298
// 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.
//
Copy link
Member

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?

Comment on lines +68 to 71
/// 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`
Copy link
Member

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 u64s.


/// (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.
Copy link
Member

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(...)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants