Skip to content

[WIP] Handle power-of-two moduli in mul_mod_special - #1352

Open
tarcieri wants to merge 2 commits into
masterfrom
fix-mul-mod-special
Open

tarcieri wants to merge 2 commits into
masterfrom
fix-mul-mod-special

Conversation

@tarcieri

@tarcieri tarcieri commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Alternative to #1282 which aims to preserve constant-time operation when handling this case.

Closes #1281

Alternative to #1282 which aims to preserve constant-time operation when
handling this case.

Closes #1281
@tarcieri
tarcieri force-pushed the fix-mul-mod-special branch from 0770785 to 7bad5f0 Compare October 6, 2026 21:36
@tarcieri

tarcieri commented Oct 6, 2026

Copy link
Copy Markdown
Member Author

Added tests but I'd still like to gauge the impact on benchmarks

@codecov

codecov Bot commented Oct 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.29%. Comparing base (d1a4e1c) to head (7bad5f0).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1352   +/-   ##
=======================================
  Coverage   91.28%   91.29%           
=======================================
  Files         190      190           
  Lines       22941    22963   +22     
=======================================
+ Hits        20942    20964   +22     
  Misses       1999     1999           

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

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

@tarcieri

tarcieri commented Oct 7, 2026 •

Copy link
Copy Markdown
Member Author

Some notable benchmark changes:

wrapping ops/boxed_rem_limb
                        time:   [448.58 ns 452.99 ns 457.71 ns]
                        change: [+23.212% +26.499% +29.870%] (p = 0.00 < 0.05)
                        Performance has regressed.
Const Montgomery arithmetic/multi_exponentiate for 10 bases, U256^U256
                        time:   [32.855 µs 33.119 µs 33.431 µs]
                        change: [+7.8154% +12.499% +17.870%] (p = 0.00 < 0.05)
                        Performance has regressed.

This branch has not been deployed

No deployments
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.

mul_mod_special panics for c = 0 in one-limb implementations

1 participant