Function ruint::algorithms::addmul
source · pub fn addmul(lhs: &mut [u64], a: &[u64], b: &[u64]) -> bool
Expand description
⚠️ Computes result += a * b
and checks for overflow.
Warning. This function is not part of the stable API.
Arrays are in little-endian order. All arrays can be arbitrary sized.
§Algorithm
Trims zeros from inputs, then uses the schoolbook multiplication algorithm. It takes the shortest input as the outer loop.
§Examples
let mut result = [0];
let overflow = addmul(&mut result, &[3], &[4]);
assert_eq!(overflow, false);
assert_eq!(result, [12]);