uint icon indicating copy to clipboard operation
uint copied to clipboard

`algorithms/mul`: carry` and `borrow` can probably be merged into a single var.

Open github-actions[bot] opened this issue 2 years ago • 0 comments

On 2022-10-24 @recmo wrote in fb3aa20 “Merge pull request #172 from recmo/div2”:

carryandborrow` can probably be merged into a single var.

/// \begin{aligned}
/// \mathsf{lhs'} &= \mod{\mathsf{lhs} - \mathsf{a} ⋅ \mathsf{b}}_{2^{64⋅N}}
/// \\\\ \mathsf{borrow} &= \floor{\frac{\mathsf{a} ⋅ \mathsf{b} -
/// \mathsf{lhs}}{2^{64⋅N}}} \end{aligned}
/// $$
// OPT: `carry` and `borrow` can probably be merged into a single var.
#[inline(always)]
pub fn submul_nx1(lhs: &mut [u64], a: &[u64], b: u64) -> u64 {
    debug_assert_eq!(lhs.len(), a.len());
    let mut carry = 0;
    let mut borrow = 0;

From src/algorithms/mul.rs:81

github-actions[bot] avatar Oct 24 '22 06:10 github-actions[bot]