Skip to main content

addmul_nx1

Function addmul_nx1 

pub const unsafe fn addmul_nx1(lhs: &mut [u64], a: &[u64], b: u64) -> u64
Expand description

⚠️ Computes lhs += a * b and returns the carry.

§Safety

lhs.len() MUST equal a.len().

In debug mode, panics if the condition of use is violated. In release, may panic or trigger UB if the condition of use is violated.

⚠️ This function is not part of the stable API.
$$ \begin{aligned} \mathsf{lhs'} &= \mod{\mathsf{lhs} + \mathsf{a} ⋅ \mathsf{b}}_{2^{64⋅N}} \\\\ \mathsf{carry} &= \floor{\frac{\mathsf{lhs} + \mathsf{a} ⋅ \mathsf{b} }{2^{64⋅N}}} \end{aligned} $$