From c8b2b619cbc71a7c19d7191b2b0232c20d102edf Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Thu, 29 May 2025 16:49:12 +0200 Subject: [PATCH] fix: gt_u64_max --- proptest-regressions/pow.txt | 1 + src/bits.rs | 2 +- src/from.rs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/proptest-regressions/pow.txt b/proptest-regressions/pow.txt index 2d90c766..3b940097 100644 --- a/proptest-regressions/pow.txt +++ b/proptest-regressions/pow.txt @@ -6,3 +6,4 @@ # everyone who runs the test benefits from these saved cases. cc 6094eff41642fcafe6b3f005cb37be0a1325663279a398d9a322b9713e31dfaf # shrinks to b = 2, e = 0 cc 91ec14a644e5bb122d26bff9b283ec81f2410e2ce2c0650263bef622c45c0b82 # shrinks to e = 1 +cc 59c1c81a16f5f196bcc05ffd83cc3cfa6f16e281bac0e0c058b25b2fc8e87792 # shrinks to e = 0 diff --git a/src/bits.rs b/src/bits.rs index 06b47a18..330bd615 100644 --- a/src/bits.rs +++ b/src/bits.rs @@ -137,7 +137,7 @@ impl Uint { /// Returns the number of significant words (limbs) in the integer. /// - /// If this is 0, then `limbs[1..]` are all non-zero. + /// If this is 0, then `self` is zero. #[inline] pub(crate) const fn count_significant_words(&self) -> usize { let mut i = LIMBS; diff --git a/src/from.rs b/src/from.rs index f04cf02f..106c4927 100644 --- a/src/from.rs +++ b/src/from.rs @@ -328,7 +328,7 @@ impl Uint { .fold(0u64, core::ops::BitOr::bitor) != 0 } else { - self.count_significant_words() == 0 + self.bit_len() > 64 } } }