ring icon indicating copy to clipboard operation
ring copied to clipboard

arithmetic: Rewrite `limbs_reduce_once`.

Open briansmith opened this issue 10 months ago • 1 comments

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.

git difftool HEAD^1:src/limb.rs src/arithmetic/limbs/reduce_once.rs

briansmith avatar Mar 03 '25 18:03 briansmith

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 96.58%. Comparing base (a5220ab) to head (290b36f). :warning: Report is 358 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2435   +/-   ##
=======================================
  Coverage   96.57%   96.58%           
=======================================
  Files         178      181    +3     
  Lines       21607    21653   +46     
  Branches      533      533           
=======================================
+ Hits        20868    20913   +45     
  Misses        626      626           
- Partials      113      114    +1     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Mar 03 '25 18:03 codecov[bot]