isqrt: assume
that isqrt
takes half as many bits
https://github.com/rust-lang/rust/issues/89273#issuecomment-970581089
This commit is contained in:
parent
77f9eae995
commit
fcdfd5b0b9
@ -2017,6 +2017,13 @@ macro_rules! uint_impl {
|
|||||||
one >>= 2;
|
one >>= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SAFETY: the result is positive and fits in an integer with half as many bits.
|
||||||
|
// Inform the optimizer about it.
|
||||||
|
unsafe {
|
||||||
|
intrinsics::assume(0 < res);
|
||||||
|
intrinsics::assume(res < 1 << (Self::BITS / 2));
|
||||||
|
}
|
||||||
|
|
||||||
res
|
res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user