mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-04 23:17:46 +00:00
factor::numeric: Use debug_assert! for runtime assertions.
This commit is contained in:
parent
774feb0a40
commit
3f79be0219
1 changed files with 3 additions and 3 deletions
|
@ -130,7 +130,7 @@ impl<T: Int> Arithmetic for Montgomery<T> {
|
|||
|
||||
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<T: Int>(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<T: Int>(a: T) -> T {
|
|||
newr = newrp;
|
||||
}
|
||||
|
||||
assert_eq!(r, one);
|
||||
debug_assert_eq!(r, one);
|
||||
t
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue