Skip to main content

submul_nx1

Function submul_nx1 

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

⚠️ Computes lhs -= a * b and returns the borrow.

§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{borrow} &= \ceil{\frac{\mathsf{a} ⋅ \mathsf{b} - \mathsf{lhs}}{2^{64⋅N}}} \end{aligned} $$