#[doc(hidden)] #[macro_export(local_inner_macros)] macro_rules! impl_wide_vector_operations { ( $struct: ident { $($field: ident), + }, $size: expr ) => { impl> fixed_wide_traits::wide::WideMul for $struct { type Output=$struct; #[inline] fn wide_mul(self, rhs: Self) -> Self::Output { $struct{ $( $field: self.$field.wide_mul(rhs.$field) ), + } } } impl,U,T:fixed_wide_traits::wide::WideMul> fixed_wide_traits::wide::WideDot<$struct> for $struct { type Output=V; #[inline] fn wide_dot(self, rhs: $struct) -> Self::Output { $crate::sum_repeating!( $( + (self.$field.wide_mul(rhs.$field)) ) + ) } } impl,T:Copy+fixed_wide_traits::wide::WideMul> $struct { #[inline] pub fn wide_length_squared(&self) -> U { $crate::sum_repeating!( $( + self.$field.wide_mul(self.$field) ) + ) } } }; } // HACK: Allows us to sum repeating tokens in macros. // See: https://stackoverflow.com/a/60187870/17452730 #[doc(hidden)] #[macro_export(local_inner_macros)] macro_rules! sum_repeating { ( + $($item: tt) * ) => { $($item) * }; }