use crate::{define_wrapper, scalars};
define_wrapper!(Su);
scalars! {
Su, Su8, su8, u8;
Su, Su16, su16, u16;
Su, Su32, su32, u32;
Su, Su64, su64, u64;
Su, Su128, su128, u128;
}
macro_rules! unsigned_scalar_methods {
($($alias:ident, $ctor:ident);+ $(;)?) => {
$(
impl $alias {
#[inline]
#[must_use]
pub const fn abs_diff(self, rhs: Self) -> Self {
$ctor(self.into_inner().abs_diff(rhs.into_inner()))
}
#[inline]
#[must_use]
pub const fn is_power_of_two(self) -> bool {
self.into_inner().is_power_of_two()
}
#[inline]
#[must_use]
pub const fn next_power_of_two(self) -> Self {
match self.checked_next_power_of_two() {
Some(v) => v,
None => Self::MAX,
}
}
#[inline]
#[must_use]
pub const fn checked_next_power_of_two(self) -> Option<Self> {
match self.into_inner().checked_next_power_of_two() {
Some(v) => Some($ctor(v)),
None => None,
}
}
#[inline]
#[must_use]
pub const fn isqrt(self) -> Self {
$ctor(self.into_inner().isqrt())
}
}
)+
};
}
unsigned_scalar_methods! {
Su8, su8;
Su16, su16;
Su32, su32;
Su64, su64;
Su128, su128;
}