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

All modified and coverable lines are covered by tests ✅

Project coverage is 96.62%. Comparing base (ecbcdb3) to head (36d857e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2283      +/-   ##
==========================================
+ Coverage   96.60%   96.62%   +0.01%     
==========================================
  Files         176      177       +1     
  Lines       21640    21670      +30     
  Branches      529      529              
==========================================
+ Hits        20906    20939      +33     
  Misses        618      618              
+ Partials      116      113       -3     

☔ 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 3 times, most recently from 43a078c to e4594c1 Compare January 25, 2025 23:25
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 done 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