Module malachite_base::num::arithmetic::saturating_sub
source · Expand description
SaturatingSub
and
SaturatingSubAssign
, traits for subtracting two numbers and
saturating at numeric bounds instead of overflowing.
§saturating_sub_assign
use malachite_base::num::arithmetic::traits::SaturatingSubAssign;
let mut x = 456u16;
x.saturating_sub_assign(123);
assert_eq!(x, 333);
let mut x = 123u16;
x.saturating_sub_assign(456);
assert_eq!(x, 0);