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

Add a few simplifications around Mont inverse #788

Merged
merged 3 commits into from
Feb 27, 2024

Conversation

tcoratger
Copy link
Contributor

@tcoratger tcoratger commented Feb 23, 2024

Description

  • When using div2 method of BigInt, we traverse the members in the opposite direction (big endian order) with a loop which until now was carried out in the little endian order. Therefore, in each iteration of the loop, the calculation of N - i - 1 was necessary. If we go through the limbs in the opposite direction with a while as I propose here, the calculation is no longer carried out on each pass, because we take the member i directly.
  • In the inverse method of the Montgomery back end, when we exit the following piece of code:
if a.is_zero() {
  None
}

there is no need for the else, because the rest will necessarily take place if a is not zero. Therefore, I removed the else here to avoid unnecessary indentations.

@tcoratger tcoratger requested review from a team as code owners February 23, 2024 21:21
@tcoratger tcoratger requested review from z-tech, Pratyush and mmagician and removed request for a team February 23, 2024 21:21
ff/src/biginteger/mod.rs Outdated Show resolved Hide resolved
Co-authored-by: Pratyush Mishra <[email protected]>
@Pratyush Pratyush added this pull request to the merge queue Feb 27, 2024
Merged via the queue into arkworks-rs:master with commit 2a8f518 Feb 27, 2024
37 checks passed
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.

2 participants