Module malachite_base::num::arithmetic::saturating_mul
source · Expand description
SaturatingMul
and
SaturatingMulAssign
, traits for multiplying two numbers and
saturating at numeric bounds instead of overflowing.
§saturating_mul_assign
use malachite_base::num::arithmetic::traits::SaturatingMulAssign;
let mut x = 123u16;
x.saturating_mul_assign(456);
assert_eq!(x, 56088);
let mut x = 123u8;
x.saturating_mul_assign(200);
assert_eq!(x, 255);