Module malachite_base::num::arithmetic::mod_power_of_2_pow

source ·
Expand description

ModPowerOf2Pow and ModPowerOf2PowAssign, traits for raising a number to a power modulo $2^k$.

§mod_power_of_2_pow

use malachite_base::num::arithmetic::traits::ModPowerOf2Pow;

assert_eq!(5u8.mod_power_of_2_pow(13, 3), 5);
assert_eq!(7u32.mod_power_of_2_pow(1000, 6), 1);

§mod_power_of_2_pow_assign

use malachite_base::num::arithmetic::traits::ModPowerOf2PowAssign;

let mut n = 5u8;
n.mod_power_of_2_pow_assign(13, 3);
assert_eq!(n, 5);

let mut n = 7u32;
n.mod_power_of_2_pow_assign(1000, 6);
assert_eq!(n, 1);