From e66a245c7804a716e13bc9db9e18cb3fbaf78688 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 10 Sep 2024 10:02:11 -0700 Subject: [PATCH] delete fixed-wide --- fixed_wide_vectors/Cargo.lock | 1 - fixed_wide_vectors/Cargo.toml | 8 +- fixed_wide_vectors/src/macros/fixed_wide.rs | 212 -------------------- fixed_wide_vectors/src/macros/matrix.rs | 4 - fixed_wide_vectors/src/macros/mod.rs | 3 - fixed_wide_vectors/src/macros/vector.rs | 6 - fixed_wide_vectors/src/tests/mod.rs | 1 - 7 files changed, 3 insertions(+), 232 deletions(-) delete mode 100644 fixed_wide_vectors/src/macros/fixed_wide.rs diff --git a/fixed_wide_vectors/Cargo.lock b/fixed_wide_vectors/Cargo.lock index 7c320dd..5bb2156 100644 --- a/fixed_wide_vectors/Cargo.lock +++ b/fixed_wide_vectors/Cargo.lock @@ -28,7 +28,6 @@ name = "fixed_wide_vectors" version = "0.1.0" dependencies = [ "fixed_wide", - "paste", ] [[package]] diff --git a/fixed_wide_vectors/Cargo.toml b/fixed_wide_vectors/Cargo.toml index ce607be..7b1c0f5 100644 --- a/fixed_wide_vectors/Cargo.toml +++ b/fixed_wide_vectors/Cargo.toml @@ -4,10 +4,8 @@ version = "0.1.0" edition = "2021" [features] -default=["fixed_wide","named-fields"] +default=["named-fields"] named-fields=[] -fixed_wide=["dep:fixed_wide","dep:paste"] -[dependencies] -fixed_wide = { version = "0.1.0", path = "../fixed_wide", optional = true } -paste = { version = "1.0.15", optional = true } +[dev-dependencies] +fixed_wide = { version = "0.1.0", path = "../fixed_wide" } diff --git a/fixed_wide_vectors/src/macros/fixed_wide.rs b/fixed_wide_vectors/src/macros/fixed_wide.rs deleted file mode 100644 index 0a2e0eb..0000000 --- a/fixed_wide_vectors/src/macros/fixed_wide.rs +++ /dev/null @@ -1,212 +0,0 @@ -#[doc(hidden)] -#[macro_export(local_inner_macros)] -macro_rules! impl_wide_vector_operations_2arg_not_const_generic { - ( - (), - ($lhs:expr, $rhs:expr) - ) => { - impl Vector>{ - paste::item!{ - #[inline] - pub fn [](self,rhs:Vector>)->Vector>{ - self.map_zip(rhs,|(a,b)|a.[](b)) - } - #[inline] - pub fn [](self,rhs:Vector>)->fixed_wide::fixed::Fixed<{$lhs+$rhs},{($lhs+$rhs)*32}>{ - self.array.into_iter().zip(rhs.array).map(|(a,b)|a.[](b)).sum() - } - } - } - } -} -#[doc(hidden)] -#[macro_export(local_inner_macros)] -macro_rules! impl_wide_vector_operations_1arg_not_const_generic { - ( - (), - $n:expr - ) => { - impl Vector>{ - paste::item!{ - #[inline] - pub fn wide_length_squared(&self)->fixed_wide::fixed::Fixed<{$n*2},{$n*2*32}>{ - self.array.into_iter().map(|t|t.[](t)).sum() - } - } - } - }; -} - -#[doc(hidden)] -#[macro_export(local_inner_macros)] -macro_rules! do_macro_8x8{ - ( - $macro:ident, - $any:tt - )=>{ - $crate::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! do_macro_8{ - ( - $macro:ident, - $any:tt - )=>{ - $crate::macro_repeated!($macro, $any, 1,2,3,4,5,6,7,8); - }; -} - -#[doc(hidden)] -#[macro_export(local_inner_macros)] -macro_rules! impl_wide_vector_operations { - () => { - $crate::do_macro_8!(impl_wide_vector_operations_1arg_not_const_generic,()); - $crate::do_macro_8x8!(impl_wide_vector_operations_2arg_not_const_generic,()); - }; -} - -#[doc(hidden)] -#[macro_export(local_inner_macros)] -macro_rules! impl_vector_3_wide_cross { - ( - (), - ($lhs:expr, $rhs:expr) - )=>{ - impl Vector<3,fixed_wide::fixed::Fixed<{$lhs},{$lhs*32}>>{ - paste::item!{ - #[inline] - pub fn [](self,rhs:Vector<3,fixed_wide::fixed::Fixed<{$rhs},{$rhs*32}>>)->Vector<3,fixed_wide::fixed::Fixed<{$lhs+$rhs},{($lhs+$rhs)*32}>>{ - Vector::new([ - self.y.[](rhs.z)-self.z.[](rhs.y), - self.z.[](rhs.x)-self.x.[](rhs.z), - self.x.[](rhs.y)-self.y.[](rhs.x), - ]) - } - } - } - } -} - -#[doc(hidden)] -#[macro_export(local_inner_macros)] -macro_rules! impl_vector_wide_3 { - ()=>{ - $crate::do_macro_8x8!(impl_vector_3_wide_cross,()); - } -} - -#[doc(hidden)] -#[macro_export(local_inner_macros)] -macro_rules! do_macro_4_dumb{ - ( - $macro:ident, - $any:tt - )=>{ - $crate::macro_repeated!($macro, $any, (1,2),(2,4),(3,6),(4,8)); - }; -} - -#[doc(hidden)] -#[macro_export(local_inner_macros)] -macro_rules! impl_matrix_wide_dot { - ( - (), - ($lhs: expr, $rhs: expr) - ) => { - impl Matrix>{ - paste::item!{ - #[inline] - pub fn [](self,rhs:Matrix>)->Matrix>{ - let mut array_of_iterators=rhs.array.map(|axis|axis.into_iter().cycle()); - Matrix::new( - self.array.map(|axis| - core::array::from_fn(|_| - // axis dot product with transposed rhs array - axis.iter().zip( - array_of_iterators.iter_mut() - ).map(|(&lhs_value,rhs_iter)| - lhs_value.[](rhs_iter.next().unwrap()) - ).sum() - ) - ) - ) - } - } - } - } -} - -#[doc(hidden)] -#[macro_export(local_inner_macros)] -macro_rules! impl_matrix_wide_dot_8x8 { - () => { - $crate::do_macro_8x8!(impl_matrix_wide_dot,()); - } -} - -#[doc(hidden)] -#[macro_export(local_inner_macros)] -macro_rules! impl_matrix_wide_3x3_det_not_const_generic { - ( - $n: expr, - $_2n: expr - )=>{ - impl Matrix<3,3,fixed_wide::fixed::Fixed<$n,{$n*32}>>{ - paste::item!{ - pub fn [](self)->fixed_wide::fixed::Fixed<{$n*3},{$n*3*32}>{ - //[] will not compile, so the doubles are hardcoded above - self.x_axis.[](self.y_axis.[](self.z_axis)) - } - } - } - } -} -#[doc(hidden)] -#[macro_export(local_inner_macros)] -macro_rules! impl_matrix_wide_3x3_det_not_const_generic_shim { - ( - (),($n: expr,$_2n: expr) - )=>{ - $crate::impl_matrix_wide_3x3_det_not_const_generic!($n,$_2n); - } -} -#[doc(hidden)] -#[macro_export(local_inner_macros)] -macro_rules! impl_matrix_wide_3x3_adjugate_not_const_generic { - ( - (), - $n: expr - )=>{ - impl Matrix<3,3,fixed_wide::fixed::Fixed<$n,{$n*32}>>{ - paste::item!{ - pub fn [](self)->Matrix<3,3,fixed_wide::fixed::Fixed<{$n*2},{$n*2*32}>>{ - Matrix::new([ - [self.y_axis.y.[](self.z_axis.z)-self.y_axis.z.[](self.z_axis.y),self.x_axis.z.[](self.z_axis.y)-self.x_axis.y.[](self.z_axis.z),self.x_axis.y.[](self.y_axis.z)-self.x_axis.z.[](self.y_axis.y)], - [self.y_axis.z.[](self.z_axis.x)-self.y_axis.x.[](self.z_axis.z),self.x_axis.x.[](self.z_axis.z)-self.x_axis.z.[](self.z_axis.x),self.x_axis.z.[](self.y_axis.x)-self.x_axis.x.[](self.y_axis.z)], - [self.y_axis.x.[](self.z_axis.y)-self.y_axis.y.[](self.z_axis.x),self.x_axis.y.[](self.z_axis.x)-self.x_axis.x.[](self.z_axis.y),self.x_axis.x.[](self.y_axis.y)-self.x_axis.y.[](self.y_axis.x)], - ]) - } - } - } - } -} -#[doc(hidden)] -#[macro_export(local_inner_macros)] -macro_rules! impl_matrix_wide_3x3 { - ()=>{ - $crate::do_macro_4_dumb!(impl_matrix_wide_3x3_det_not_const_generic_shim,()); - $crate::do_macro_8!(impl_matrix_wide_3x3_adjugate_not_const_generic,()); - } -} diff --git a/fixed_wide_vectors/src/macros/matrix.rs b/fixed_wide_vectors/src/macros/matrix.rs index da7f209..56634b6 100644 --- a/fixed_wide_vectors/src/macros/matrix.rs +++ b/fixed_wide_vectors/src/macros/matrix.rs @@ -111,8 +111,6 @@ macro_rules! impl_matrix { self.transform_vector(rhs) } } - #[cfg(feature="fixed_wide")] - $crate::impl_matrix_wide_dot_8x8!(); } } @@ -217,7 +215,5 @@ macro_rules! impl_matrix_3x3 { ]) } } - #[cfg(feature="fixed_wide")] - $crate::impl_matrix_wide_3x3!(); } } diff --git a/fixed_wide_vectors/src/macros/mod.rs b/fixed_wide_vectors/src/macros/mod.rs index 572d35c..d551722 100644 --- a/fixed_wide_vectors/src/macros/mod.rs +++ b/fixed_wide_vectors/src/macros/mod.rs @@ -1,6 +1,3 @@ -#[cfg(feature="fixed_wide")] -pub mod fixed_wide; - pub mod common; pub mod vector; pub mod matrix; diff --git a/fixed_wide_vectors/src/macros/vector.rs b/fixed_wide_vectors/src/macros/vector.rs index 17f5406..37654b6 100644 --- a/fixed_wide_vectors/src/macros/vector.rs +++ b/fixed_wide_vectors/src/macros/vector.rs @@ -141,10 +141,6 @@ macro_rules! impl_vector { $crate::impl_vector_operator!(BitOr, bitor ); $crate::impl_vector_assign_operator!(BitXorAssign, bitxor_assign ); $crate::impl_vector_operator!(BitXor, bitxor ); - - // Impl floating-point based methods - #[cfg(feature="fixed_wide")] - $crate::impl_wide_vector_operations!(); } } #[doc(hidden)] @@ -244,7 +240,5 @@ macro_rules! impl_vector_3 { ]) } } - #[cfg(feature="fixed_wide")] - $crate::impl_vector_wide_3!(); } } diff --git a/fixed_wide_vectors/src/tests/mod.rs b/fixed_wide_vectors/src/tests/mod.rs index 06e9ee5..5bdf283 100644 --- a/fixed_wide_vectors/src/tests/mod.rs +++ b/fixed_wide_vectors/src/tests/mod.rs @@ -3,5 +3,4 @@ mod tests; #[cfg(feature="named-fields")] mod named; -#[cfg(feature="fixed_wide")] mod fixed_wide;