Skip to content

Add #[inline] to shift and wrapping arithmetic ops#1229

Open
cong-or wants to merge 1 commit intoRustCrypto:masterfrom
cong-or:inline-shift-wrapping
Open

Add #[inline] to shift and wrapping arithmetic ops#1229
cong-or wants to merge 1 commit intoRustCrypto:masterfrom
cong-or:inline-shift-wrapping

Conversation

@cong-or
Copy link

@cong-or cong-or commented Mar 21, 2026

Went through the shift and wrapping arithmetic paths and added #[inline] where it was missing — mostly thin wrappers and small loop bodies in Uint, Int, and Limb.

Stuck with #[inline] over #[inline(always)] so LLVM still gets the final say.

Ran benchmarks before/after on default codegen-units:

Benchmark Change
shl, U2048 -5.5%
shl_vartime large, U2048 -12.7%
shr, U2048 -10.9%
shr_vartime large, U2048 -12.3%
shr_vartime_wide, U2048 -11.4%
wrapping_square, U256 -18%
widening_mul, I2048 -18%

Still working through the rest of the ops flagged in #981, will follow up separately.

@cong-or cong-or mentioned this pull request Mar 21, 2026
12 tasks
@codecov
Copy link

codecov bot commented Mar 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.99%. Comparing base (9ba2ef6) to head (984209d).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1229   +/-   ##
=======================================
  Coverage   87.99%   87.99%           
=======================================
  Files         184      184           
  Lines       21244    21244           
=======================================
  Hits        18693    18693           
  Misses       2551     2551           

☔ View full report in Codecov by Sentry.
📢 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.

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