From 540749e4f10e54e35188b36ab558048e4d2cd146 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 29 Aug 2024 19:52:00 -0700 Subject: [PATCH] there is a poorly named function for this --- fixed_wide/src/fixed_wide_traits.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fixed_wide/src/fixed_wide_traits.rs b/fixed_wide/src/fixed_wide_traits.rs index b2b41de..185ec95 100644 --- a/fixed_wide/src/fixed_wide_traits.rs +++ b/fixed_wide/src/fixed_wide_traits.rs @@ -63,7 +63,7 @@ impl Fixed //2. divide by 2 via >>1 (sqrt-ish) //3. add on fractional offset //Voila - let used_bits=CHUNKS as i32*64-1-Frac::I32-self.bits.leading_zeros() as i32; + let used_bits=self.bits.bits() as i32-1-Frac::I32; let max_shift=((used_bits>>1)+Frac::I32) as u32; let mut result=Self::ZERO;