use core::ops::RangeInclusive;
use crate::bitman::IsBitHigh;
pub trait AreBitsLow {
type Type;
fn are_bits_low(&self, range: RangeInclusive<Self::Type>) -> bool;
}
macro_rules! ImplementAreBitsLow {
($type:ty) => {
impl AreBitsLow for $type {
type Type = Self;
#[inline]
#[must_use]
fn are_bits_low(&self, range: RangeInclusive<Self>) -> bool {
for index in range {
if self.is_bit_high(index) {
return false;
}
}
true
}
}
};
}
ImplementAreBitsLow!(u8);
ImplementAreBitsLow!(u32);
ImplementAreBitsLow!(u64);