Module malachite_base::num::arithmetic::mod_power_of_2_sub
source · Expand description
ModPowerOf2Sub
and
ModPowerOf2SubAssign
, traits for subtracting one number by
another modulo $2^k$.
§mod_power_of_2_sub
use malachite_base::num::arithmetic::traits::ModPowerOf2Sub;
assert_eq!(5u8.mod_power_of_2_sub(2, 5), 3);
assert_eq!(10u32.mod_power_of_2_sub(14, 4), 12);
§mod_power_of_2_sub_assign
use malachite_base::num::arithmetic::traits::ModPowerOf2SubAssign;
let mut n = 5u8;
n.mod_power_of_2_sub_assign(2, 5);
assert_eq!(n, 3);
let mut n = 10u32;
n.mod_power_of_2_sub_assign(14, 4);
assert_eq!(n, 12);