diff --git a/fixed_wide_vectors/src/macros/fixed_wide.rs b/fixed_wide_vectors/src/macros/fixed_wide.rs index d6a9eec..1cf0cb9 100644 --- a/fixed_wide_vectors/src/macros/fixed_wide.rs +++ b/fixed_wide_vectors/src/macros/fixed_wide.rs @@ -1,16 +1,18 @@ #[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; +macro_rules! impl_wide_vector_operations_const { + ( $lhs:expr, $rhs:expr, ($struct: ident { $($field: ident), + }, $size: expr) ) => { + impl $struct>{ + paste::item!{ #[inline] - fn wide_mul(self, rhs: Self) -> Self::Output { + pub fn [](self,rhs:$struct>)->$struct>{ $struct{ - $( $field: self.$field.wide_mul(rhs.$field) ), + + $( $field: self.$field.[](rhs.$field) ), + } } + } } + /* impl,U,T:fixed_wide_traits::wide::WideMul> fixed_wide_traits::wide::WideDot<$struct> for $struct { type Output=V; #[inline] @@ -28,6 +30,48 @@ macro_rules! impl_wide_vector_operations { ) } } + */ + }; +} +#[doc(hidden)] +#[macro_export(local_inner_macros)] +macro_rules! do_macro_repeated{ + ( + $macro:ident, + $any:tt, + $(($x:expr, $y:expr)),* + )=>{ + $( + $crate::$macro!($x, $y, $any); + )* + }; +} + +#[doc(hidden)] +#[macro_export(local_inner_macros)] +macro_rules! do_macro_8x8{ + ( + $macro:ident, + $any:tt + )=>{ + $crate::do_macro_repeated!($macro, $any, + (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1), + (1,2),(2,2),(3,2),(4,2),(5,2),(6,2),(7,2),(8,2), + (1,3),(2,3),(3,3),(4,3),(5,3),(6,3),(7,3),(8,3), + (1,4),(2,4),(3,4),(4,4),(5,4),(6,4),(7,4),(8,4), + (1,5),(2,5),(3,5),(4,5),(5,5),(6,5),(7,5),(8,5), + (1,6),(2,6),(3,6),(4,6),(5,6),(6,6),(7,6),(8,6), + (1,7),(2,7),(3,7),(4,7),(5,7),(6,7),(7,7),(8,7), + (1,8),(2,8),(3,8),(4,8),(5,8),(6,8),(7,8),(8,8) + ); + }; +} + +#[doc(hidden)] +#[macro_export(local_inner_macros)] +macro_rules! impl_wide_vector_operations { + ( $struct: ident { $($field: ident), + }, $size: expr ) => { + $crate::do_macro_8x8!(impl_wide_vector_operations_const,($struct { $($field), + }, $size)); }; }