save a copy in sqrt using epic bnum 0.12 feature (pulled by yours truly)
This commit is contained in:
parent
2b58204cb9
commit
e46f4fb900
@ -708,7 +708,11 @@ macro_rules! impl_not_const_generic{
|
|||||||
let wide_self=self.[<fix_ $_2n>]();
|
let wide_self=self.[<fix_ $_2n>]();
|
||||||
//descend down the bits and check if flipping each bit would push the square over the input value
|
//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(){
|
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.[<wide_mul_ $n _ $n>](new_result)<=wide_self{
|
if new_result.[<wide_mul_ $n _ $n>](new_result)<=wide_self{
|
||||||
result=new_result;
|
result=new_result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user