MACRO MACRO MACRO
This commit is contained in:
parent
e98744871b
commit
b14c84bdad
@ -1,16 +1,18 @@
|
||||
#[doc(hidden)]
|
||||
#[macro_export(local_inner_macros)]
|
||||
macro_rules! impl_wide_vector_operations {
|
||||
( $struct: ident { $($field: ident), + }, $size: expr ) => {
|
||||
impl<U,T:Copy+fixed_wide_traits::wide::WideMul<Output=U>> fixed_wide_traits::wide::WideMul for $struct<T> {
|
||||
type Output=$struct<U>;
|
||||
macro_rules! impl_wide_vector_operations_const {
|
||||
( $lhs:expr, $rhs:expr, ($struct: ident { $($field: ident), + }, $size: expr) ) => {
|
||||
impl $struct<fixed_wide::fixed::Fixed<{$lhs},{$lhs*32}>>{
|
||||
paste::item!{
|
||||
#[inline]
|
||||
fn wide_mul(self, rhs: Self) -> Self::Output {
|
||||
pub fn [<wide_mul_ $lhs _ $rhs>](self,rhs:$struct<fixed_wide::fixed::Fixed<{$rhs},{$rhs*32}>>)->$struct<fixed_wide::fixed::Fixed<{$lhs+$rhs},{($lhs+$rhs)*32}>>{
|
||||
$struct{
|
||||
$( $field: self.$field.wide_mul(rhs.$field) ), +
|
||||
$( $field: self.$field.[<wide_mul_ $lhs _ $rhs>](rhs.$field) ), +
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
impl<V:core::ops::Add<Output=V>,U,T:fixed_wide_traits::wide::WideMul<U,Output=V>> fixed_wide_traits::wide::WideDot<$struct<U>> for $struct<T> {
|
||||
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));
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user