`algorithms/div/small`: Version with in-place shifting of `u`
Opened this issue · 0 comments
github-actions commented
On 2022-10-24 @recmo wrote in fb3aa20
“Merge pull request #172 from recmo/div2”:
Version with in-place shifting of u
/// The divisor must be normalized. See algorithm 7 from [MG10].
///
/// [MG10]: https://gmplib.org/~tege/division-paper.pdf
#[inline(always)]
pub fn div_nx1_normalized(u: &mut [u64], d: u64) -> u64 {
// OPT: Version with in-place shifting of `u`
debug_assert!(d >= (1 << 63));
let v = reciprocal(d);
let mut r: u64 = 0;
for u in u.iter_mut().rev() {