#![doc(hidden)]
#[must_use]
#[inline(always)]
#[allow(clippy::match_bool)] pub const fn lower_n_mask(n: u64) -> u64 {
debug_assert!(n <= 64, "lower_n_mask() overflow in shl.");
match n == 64 {
true => u64::MAX,
false => (1 << n) - 1,
}
}
#[must_use]
#[inline(always)]
#[allow(clippy::match_bool)] pub const fn lower_n_halfway(n: u64) -> u64 {
debug_assert!(n <= 64, "lower_n_halfway() overflow in shl.");
match n == 0 {
true => 0,
false => nth_bit(n - 1),
}
}
#[must_use]
#[inline(always)]
pub const fn nth_bit(n: u64) -> u64 {
debug_assert!(n < 64, "nth_bit() overflow in shl.");
1 << n
}