This commit is contained in:
Quaternions 2024-08-30 12:07:03 -07:00
parent 63cf94499b
commit 247987b51d

View File

@ -31,6 +31,43 @@ macro_rules! impl_wide_vector_operations {
}; };
} }
/*
#[doc(hidden)]
#[macro_export(local_inner_macros)]
macro_rules! impl_wide_matrix_operations {
(
($struct_outer: ident { $($field_outer: ident), + }, $size_outer: expr),
($struct_inner: ident, $size_inner: expr), $fields_inner:tt
) => {
impl<U,T:Copy+fixed_wide_traits::wide::WideMul<Output=U>> fixed_wide_traits::wide::WideMul for $struct<T> {
type Output=$struct<U>;
#[inline]
fn wide_mul(self, rhs: Self) -> Self::Output {
$struct{
$( $field: self.$field.wide_mul(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]
fn wide_dot(self, rhs: $struct<U>) -> Self::Output {
$crate::sum_repeating!(
$( + (self.$field.wide_mul(rhs.$field)) ) +
)
}
}
impl<U:std::ops::Add<Output=U>,T:Copy+fixed_wide_traits::wide::WideMul<Output=U>> $struct<T> {
#[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. // HACK: Allows us to sum repeating tokens in macros.
// See: https://stackoverflow.com/a/60187870/17452730 // See: https://stackoverflow.com/a/60187870/17452730