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

factor: enable a debug_assert! statement #5995

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions src/uu/factor/src/numeric/montgomery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,11 @@ pub(crate) trait Arithmetic: Copy + Sized {

// Check that r (reduced back to the usual representation) equals
// a^b % n, unless the latter computation overflows
// Temporarily commented-out, as there u64::checked_pow is not available
// on the minimum supported Rust version, nor is an appropriate method
// for compiling the check conditionally.
//debug_assert!(self
// .to_u64(_a)
// .checked_pow(_b as u32)
// .map(|r| r % self.modulus() == self.to_u64(result))
// .unwrap_or(true));
debug_assert!(self
.to_u64(_a)
.checked_pow(_b as u32)
.map(|r| r % self.modulus() == self.to_u64(result))
.unwrap_or(true));

result
}
Expand Down
Loading