Expand description

WrappingAddMul and WrappingAddMulAssign, traits for adding the product of two numbers to a third and wrapping at the boundary of the type.

wrapping_add_mul

use malachite_base::num::arithmetic::traits::WrappingAddMul;

assert_eq!(2u8.wrapping_add_mul(3, 7), 23);
assert_eq!((-127i8).wrapping_add_mul(-2, 100), -71);

wrapping_add_mul_assign

use malachite_base::num::arithmetic::traits::WrappingAddMulAssign;

let mut x = 2u8;
x.wrapping_add_mul_assign(3, 7);
assert_eq!(x, 23);

let mut x = -127i8;
x.wrapping_add_mul_assign(-2, 100);
assert_eq!(x, -71);