fast
This commit is contained in:
parent
61aad93f8d
commit
0483c9eb27
@ -75,7 +75,7 @@ impl<const CHUNKS:usize,Frac:Unsigned> Fixed<CHUNKS,Frac>
|
|||||||
//cheat to make the types match
|
//cheat to make the types match
|
||||||
let wide_self=self.wide_mul(Fixed::<CHUNKS,Frac>::ONE);
|
let wide_self=self.wide_mul(Fixed::<CHUNKS,Frac>::ONE);
|
||||||
for shift in (0..=max_shift).rev(){
|
for shift in (0..=max_shift).rev(){
|
||||||
let new_result=result|(Fixed::<CHUNKS,Frac>::EPSILON<<shift);
|
let new_result=result|Fixed::<CHUNKS,Frac>::from_bits(BInt::from_bits(bnum::BUint::power_of_two(shift)));
|
||||||
if new_result.wide_mul(new_result)<=wide_self{
|
if new_result.wide_mul(new_result)<=wide_self{
|
||||||
result=new_result;
|
result=new_result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user