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

arithmetic: Rewrite limbs_reduce_once. #2283

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

briansmith
Copy link
Owner

See the individual commit messages for details.

@briansmith briansmith self-assigned this Jan 24, 2025
Copy link

codecov bot commented Jan 24, 2025

Codecov Report

Attention: Patch coverage is 96.15385% with 2 lines in your changes missing coverage. Please review.

Project coverage is 96.75%. Comparing base (63dc1e5) to head (e4594c1).

Files with missing lines Patch % Lines
src/arithmetic/add.rs 92.59% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2283      +/-   ##
==========================================
- Coverage   96.76%   96.75%   -0.01%     
==========================================
  Files         173      174       +1     
  Lines       20872    20896      +24     
  Branches      487      488       +1     
==========================================
+ Hits        20196    20218      +22     
- Misses        575      576       +1     
- Partials      101      102       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@briansmith briansmith force-pushed the b/limbs-reduce-once branch 2 times, most recently from d5be4f5 to 43a078c Compare January 24, 2025 23:47
Move the function to `arithmetic` from `limb`. This is step towards
moving all arithmetic out of `limb`.

Change the signature so that the reduction is non separately instead
of in-place. It was already being done separately in `bigint` and it
costs very little, if anything, to do the same in the other caller in
`ec`.

Optimize the implementation to take advantage of the fact that `r`
and `a` do not alias each other. To do so, replace
`LIMBS_reduce_once` with two separate helper functions, `LIMBS_sub`
and `LIMBS_cmov`.

As part of doing this, ensure we're not passing any empty slices to
the relevant C code.
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.

1 participant