1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-14 19:16:17 +00:00

Merge pull request #5995 from cakebaker/factor_enable_debug_assert

factor: enable a debug_assert! statement
This commit is contained in:
Sylvestre Ledru 2024-02-22 16:51:54 +01:00 committed by GitHub
commit f7821cd0d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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
}