Skip to content

Conversation

@andrewwhitehead
Copy link
Contributor

@andrewwhitehead andrewwhitehead commented Oct 29, 2025

This optimizes Int::wrapping_mul and Uint::checked_mul_int to make use of Uint::wrapping_mul, and adds Int::saturating_mul.

@codecov
Copy link

codecov bot commented Oct 29, 2025

Codecov Report

❌ Patch coverage is 98.41270% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.87%. Comparing base (f3e6291) to head (7a5a14a).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/int/mul.rs 98.93% 1 Missing ⚠️
src/int/mul_uint.rs 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #998      +/-   ##
==========================================
- Coverage   79.89%   79.87%   -0.02%     
==========================================
  Files         163      163              
  Lines       17606    17709     +103     
==========================================
+ Hits        14066    14145      +79     
- Misses       3540     3564      +24     

☔ 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.

pub const SIGN_MASK: Self = Self::MIN; // Bit sequence (be): 1000....0000

/// All-one bit mask.
pub const FULL_MASK: Self = Self(Uint::MAX); // Bit sequence (be): 1111...1111
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This constant was public, but I can't imagine what it would be needed for, besides the internal usage in calculating MINUS_ONE which has been updated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably apply the unreachable_pub lint

@tarcieri
Copy link
Member

@andrewwhitehead looks like this now has a conflict, possibly from #1008. Can you rebase and I can do another pass on this?

Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
simplify Int::wrapping_mul and add test

Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
@tarcieri tarcieri merged commit 75001b2 into RustCrypto:master Nov 25, 2025
26 checks passed
tarcieri added a commit that referenced this pull request Nov 26, 2025
This reverts commit 75001b2 (#998)

We're noticing CI failures on cross which seem to be related to this
change, e.g.

https://github.com/RustCrypto/crypto-bigint/actions/runs/19647957432/job/56267760132

It looks like it's potentially getting stuck in an infinite loop.
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.

2 participants