pub const fn genmask_u32(range: RangeInclusive<u32>) -> u32
Expand description
Creates a compile-time contiguous bitmask for the given range by performing a compile-time assertion that the range is valid.
This version is the default and should be used if the range is known at compile time.
ยงExamples
assert_eq!(genmask_u32(21..=31), 0xffe0_0000);
assert_eq!(genmask_u32(0..=0), 0b1);
assert_eq!(genmask_u32(0..=31), u32::MAX);