Module malachite_base::num::logic::low_mask
source · Expand description
LowMask
, a trait for generating a low bit mask (a number in which only the
$k$ least-significant bits are 1).
§low_mask
use malachite_base::num::logic::traits::LowMask;
assert_eq!(u16::low_mask(0), 0);
assert_eq!(u8::low_mask(3), 0x7);
assert_eq!(u8::low_mask(8), 0xff);
assert_eq!(u64::low_mask(40), 0xffffffffff);
assert_eq!(i16::low_mask(0), 0);
assert_eq!(i8::low_mask(3), 0x7);
assert_eq!(i8::low_mask(8), -1);
assert_eq!(i64::low_mask(40), 0xffffffffff);