}
macro_rules! impl_int_vector {
- ($ty:ident) => {
+ ($ty:ident, $count_leading_zeros:ident, $count_trailing_zeros:ident, $count_ones:ident) => {
impl<const LANES: usize> Int for Wrapper<$ty<LANES>, LANES>
where
SimdI8<LANES>: LanesAtMost32,
Mask64<LANES>: Mask,
{
fn leading_zeros(self) -> Self {
- todo!()
+ crate::algorithms::integer::$count_leading_zeros(self.ctx(), self)
}
fn trailing_zeros(self) -> Self {
- todo!()
+ crate::algorithms::integer::$count_trailing_zeros(self.ctx(), self)
}
fn count_ones(self) -> Self {
- todo!()
- }
-
- fn leading_ones(self) -> Self {
- todo!()
- }
-
- fn trailing_ones(self) -> Self {
- todo!()
- }
-
- fn count_zeros(self) -> Self {
- todo!()
+ crate::algorithms::integer::$count_ones(self.ctx(), self)
}
}
};
macro_rules! impl_uint_sint_vector {
($uint:ident, $sint:ident) => {
- impl_int_vector!($uint);
- impl_int_vector!($sint);
+ impl_int_vector!(
+ $uint,
+ count_leading_zeros_uint,
+ count_trailing_zeros_uint,
+ count_ones_uint
+ );
+ impl_int_vector!(
+ $sint,
+ count_leading_zeros_sint,
+ count_trailing_zeros_sint,
+ count_ones_sint
+ );
impl<const LANES: usize> UInt for Wrapper<$uint<LANES>, LANES>
where
SimdI8<LANES>: LanesAtMost32,