uint
uint copied to clipboard
`algorithms/div/reciprocal`: This is checking the carry flag
On 2022-10-24 @recmo wrote in fb3aa20
“Merge pull request #172 from recmo/div2”:
This is checking the carry flag
let d1 = (d >> 64) as u64;
let d0 = d as u64;
let mut v = reciprocal(d1);
let mut p = d1.wrapping_mul(v).wrapping_add(d0);
// OPT: This is checking the carry flag
if p < d0 {
v = v.wrapping_sub(1);
if p >= d1 {
v = v.wrapping_sub(1);
p = p.wrapping_sub(d1);