there is a poorly named function for this

This commit is contained in:
Quaternions 2024-08-29 19:52:00 -07:00
parent 3c5f01da89
commit 540749e4f1

View File

@ -63,7 +63,7 @@ impl<const CHUNKS:usize,Frac:Unsigned> Fixed<CHUNKS,Frac>
//2. divide by 2 via >>1 (sqrt-ish) //2. divide by 2 via >>1 (sqrt-ish)
//3. add on fractional offset //3. add on fractional offset
//Voila //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 max_shift=((used_bits>>1)+Frac::I32) as u32;
let mut result=Self::ZERO; let mut result=Self::ZERO;