Module malachite_base::num::arithmetic::wrapping_add

source ·
Expand description

WrappingAdd and WrappingAddAssign, traits for adding two numbers and wrapping at the boundary of the type.

§wrapping_add_assign

use malachite_base::num::arithmetic::traits::WrappingAddAssign;

let mut x = 123u16;
x.wrapping_add_assign(456);
assert_eq!(x, 579);

let mut x = 123u8;
x.wrapping_add_assign(200);
assert_eq!(x, 67);