cast::revm::interpreter::primitives::alloy_primitives::ruint::algorithms

Function addmul_nx1

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

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

Requires lhs.len() == a.len().

$$ \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} $$