uint
uint copied to clipboard
`algorithms/gcd/matrix`: Is it safe to do this based on just the u128 prefix?
On 2022-06-06 @recmo wrote in 4c74c09
“Merge pull request #110 from recmo/gcd”:
Is it safe to do this based on just the u128 prefix? let (r0, r1) = q.apply_u128(r0, r1); let s = r0.leading_zeros(); let r0s = r0 << s; let r1s = r1 << s; let qn = Self::from_u64_prefix((r0s >> 64) as u64, (r1s >> 64) as u64);
// We can return q here and have a perfectly valid single-word Lehmer GCD.
q
// OPT: Fix the below method to get double-word Lehmer GCD.
// Recompute r0 and r1 and take the high bits.
// TODO: Is it safe to do this based on just the u128 prefix?
// let (r0, r1) = q.apply_u128(r0, r1);
// let s = r0.leading_zeros();
// let r0s = r0 << s;
// let r1s = r1 << s;
// let qn = Self::from_u64_prefix((r0s >> 64) as u64, (r1s >> 64) as
// u64);
// // Multiply matrices qn * q
// qn.compose(q)
}
}