Module malachite_base::num::arithmetic::overflowing_add
source · Expand description
OverflowingAdd
and
OverflowingAddAssign
, traits for adding two numbers and
returning a boolean indicating whether an overflow occurred.
§overflowing_add_assign
use malachite_base::num::arithmetic::traits::OverflowingAddAssign;
let mut x = 123u16;
assert_eq!(x.overflowing_add_assign(456), false);
assert_eq!(x, 579);
let mut x = 123u8;
assert_eq!(x.overflowing_add_assign(200), true);
assert_eq!(x, 67);