Module malachite_base::num::arithmetic::mod_power_of_2_mul
source · Expand description
ModPowerOf2Mul
and
ModPowerOf2MulAssign
, traits for multiplying two numbers
modulo $2^k$.
§mod_power_of_2_mul
use malachite_base::num::arithmetic::traits::ModPowerOf2Mul;
assert_eq!(3u8.mod_power_of_2_mul(2, 5), 6);
assert_eq!(10u32.mod_power_of_2_mul(14, 4), 12);
§mod_power_of_2_mul_assign
use malachite_base::num::arithmetic::traits::ModPowerOf2MulAssign;
let mut n = 3u8;
n.mod_power_of_2_mul_assign(2, 5);
assert_eq!(n, 6);
let mut n = 10u32;
n.mod_power_of_2_mul_assign(14, 4);
assert_eq!(n, 12);