diff --git a/fixed_wide/src/fixed.rs b/fixed_wide/src/fixed.rs index 446d957..a8bf944 100644 --- a/fixed_wide/src/fixed.rs +++ b/fixed_wide/src/fixed.rs @@ -708,7 +708,11 @@ macro_rules! impl_not_const_generic{ let wide_self=self.[](); //descend down the bits and check if flipping each bit would push the square over the input value for shift in (0..=max_shift).rev(){ - let new_result=result|Self::from_bits(BInt::from_bits(bnum::BUint::power_of_two(shift))); + let new_result={ + let mut bits=result.to_bits().to_bits(); + bits.set_bit(shift,true); + Self::from_bits(BInt::from_bits(bits)) + }; if new_result.[](new_result)<=wide_self{ result=new_result; }