From 70a79a8d252bd5ce03baa5e6ea938e4c077ce135 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 29 Aug 2024 18:54:43 -0700 Subject: [PATCH] remove old kludge --- fixed_wide/src/fixed_wide_traits.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fixed_wide/src/fixed_wide_traits.rs b/fixed_wide/src/fixed_wide_traits.rs index 9d6ab27..bd9ac24 100644 --- a/fixed_wide/src/fixed_wide_traits.rs +++ b/fixed_wide/src/fixed_wide_traits.rs @@ -69,7 +69,8 @@ impl Fixed //sqrt //0110.0000 //pow2 = 0100.0000 - let max_shift=((((CHUNKS as i32*64-Frac::I32-(self.bits.leading_zeros() as i32)+1)>>1)+Frac::I32) as u32).saturating_sub(1); + let used_bits=CHUNKS as i32*64-1-Frac::I32-self.bits.leading_zeros() as i32; + let max_shift=((used_bits>>1)+Frac::I32) as u32; let mut result=Self::ZERO; //cheat to make the types match