diff --git a/crates/core_simd/src/iter.rs b/crates/core_simd/src/iter.rs index b5f28b05e5c..c1c4c645db6 100644 --- a/crates/core_simd/src/iter.rs +++ b/crates/core_simd/src/iter.rs @@ -1,5 +1,5 @@ macro_rules! impl_traits { - { $type:ident, $scalar:ty } => { + { $type:ident } => { impl core::iter::Sum for crate::$type where Self: crate::LanesAtMost32, @@ -18,24 +18,6 @@ fn product>(iter: I) -> Self { } } - impl core::iter::Sum> for $scalar - where - crate::$type: crate::LanesAtMost32, - { - fn sum>>(iter: I) -> Self { - iter.sum::>().horizontal_sum() - } - } - - impl core::iter::Product> for $scalar - where - crate::$type: crate::LanesAtMost32, - { - fn product>>(iter: I) -> Self { - iter.product::>().horizontal_product() - } - } - impl<'a, const LANES: usize> core::iter::Sum<&'a Self> for crate::$type where Self: crate::LanesAtMost32, @@ -53,36 +35,18 @@ fn product>(iter: I) -> Self { iter.fold(Default::default(), core::ops::Mul::mul) } } - - impl<'a, const LANES: usize> core::iter::Sum<&'a crate::$type> for $scalar - where - crate::$type: crate::LanesAtMost32, - { - fn sum>>(iter: I) -> Self { - iter.sum::>().horizontal_sum() - } - } - - impl<'a, const LANES: usize> core::iter::Product<&'a crate::$type> for $scalar - where - crate::$type: crate::LanesAtMost32, - { - fn product>>(iter: I) -> Self { - iter.product::>().horizontal_product() - } - } } } -impl_traits! { SimdF32, f32 } -impl_traits! { SimdF64, f64 } -impl_traits! { SimdU8, u8 } -impl_traits! { SimdU16, u16 } -impl_traits! { SimdU32, u32 } -impl_traits! { SimdU64, u64 } -impl_traits! { SimdUsize, usize } -impl_traits! { SimdI8, i8 } -impl_traits! { SimdI16, i16 } -impl_traits! { SimdI32, i32 } -impl_traits! { SimdI64, i64 } -impl_traits! { SimdIsize, isize } +impl_traits! { SimdF32 } +impl_traits! { SimdF64 } +impl_traits! { SimdU8 } +impl_traits! { SimdU16 } +impl_traits! { SimdU32 } +impl_traits! { SimdU64 } +impl_traits! { SimdUsize } +impl_traits! { SimdI8 } +impl_traits! { SimdI16 } +impl_traits! { SimdI32 } +impl_traits! { SimdI64 } +impl_traits! { SimdIsize }