From 4da633b83505e6866889a314c730892722a75ef7 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Thu, 22 Feb 2024 09:33:29 +0100 Subject: [PATCH] factor: enable a debug_assert! statement --- src/uu/factor/src/numeric/montgomery.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/uu/factor/src/numeric/montgomery.rs b/src/uu/factor/src/numeric/montgomery.rs index 421699158..135b22e39 100644 --- a/src/uu/factor/src/numeric/montgomery.rs +++ b/src/uu/factor/src/numeric/montgomery.rs @@ -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 }