INNER CODE UNIT · Rust
module
ZenGo-X/curv · src/arithmetic/mod.rs:270
let module = BigInt::from(u32::MAX) + BigInt::one();
for (op, n) in ops {
let was = expected;
match op {
ModOp::Add => {
actual = BigInt::mod_add(&actual, &BigInt::from(n), &module);
expected = expected.wrapping_add(n);
}
ModOp::Sub => {
actual = BigInt::mod_sub(&actual, &BigInt::from(n), &module);
expected = expected.wrapping_sub(n);
}
ModOp::Mul => {
actual = BigInt::mod_mul(&actual, &BigInt::from(n), &module);
expected = expected.wrapping_mul(n);
}
}