From 3f79be0219285b99d33cff97fe5e92fdd3591d6b Mon Sep 17 00:00:00 2001 From: nicoo Date: Wed, 24 Jun 2020 19:18:43 +0200 Subject: [PATCH] factor::numeric: Use debug_assert! for runtime assertions. --- src/uu/factor/src/numeric.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uu/factor/src/numeric.rs b/src/uu/factor/src/numeric.rs index c6b40aa9b..5f15142ef 100644 --- a/src/uu/factor/src/numeric.rs +++ b/src/uu/factor/src/numeric.rs @@ -130,7 +130,7 @@ impl Arithmetic for Montgomery { fn from_u64(&self, x: u64) -> Self::I { // TODO: optimise! - assert!(x < self.n.as_()); + debug_assert!(x < self.n.as_()); let r = T::from_intermediate( ((T::Intermediate::from(x)) << T::zero().count_zeros() as usize) % self.n.as_intermediate(), @@ -273,7 +273,7 @@ impl Int for u32 { pub(crate) fn modular_inverse(a: T) -> T { let zero = T::zero(); let one = T::one(); - assert!(a % (one + one) == one, "{:?} is not odd", a); + debug_assert!(a % (one + one) == one, "{:?} is not odd", a); let mut t = zero; let mut newt = one; @@ -299,7 +299,7 @@ pub(crate) fn modular_inverse(a: T) -> T { newr = newrp; } - assert_eq!(r, one); + debug_assert_eq!(r, one); t }