Expand description

DivisibleByPowerOf2, a trait for determining whether a number is divisible by $2^k$.

divisible_by_power_of_2

use malachite_base::num::arithmetic::traits::DivisibleByPowerOf2;

assert_eq!(0u8.divisible_by_power_of_2(100), true);
assert_eq!(96u16.divisible_by_power_of_2(5), true);
assert_eq!(96u32.divisible_by_power_of_2(6), false);

assert_eq!(0i8.divisible_by_power_of_2(100), true);
assert_eq!((-96i16).divisible_by_power_of_2(5), true);
assert_eq!(96i32.divisible_by_power_of_2(6), false);