From 42c174df0cd5b9acaf14a338c1ee653f51e066ba Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 27 Aug 2024 18:57:11 -0700 Subject: [PATCH] idk --- fixed_wide_vectors/src/macros/length.rs | 15 +++++++++++++++ fixed_wide_vectors/src/macros/mod.rs | 2 ++ 2 files changed, 17 insertions(+) create mode 100644 fixed_wide_vectors/src/macros/length.rs diff --git a/fixed_wide_vectors/src/macros/length.rs b/fixed_wide_vectors/src/macros/length.rs new file mode 100644 index 0000000..389d7da --- /dev/null +++ b/fixed_wide_vectors/src/macros/length.rs @@ -0,0 +1,15 @@ +#[doc(hidden)] +#[macro_export(local_inner_macros)] +macro_rules! impl_length_operations { + ( $struct: ident { $($field: ident), + }, $size: expr ) => { + impl> $struct { + type Output=$struct; + #[inline] + fn wide_with_length(self, rhs: Self) -> Self::Output { + let len=self.wide_length(); + let ratio=rhs.ratio(len); + self.wide_mul(ratio) + } + } + } +} diff --git a/fixed_wide_vectors/src/macros/mod.rs b/fixed_wide_vectors/src/macros/mod.rs index 0d9be65..7b6f1f9 100644 --- a/fixed_wide_vectors/src/macros/mod.rs +++ b/fixed_wide_vectors/src/macros/mod.rs @@ -1,5 +1,7 @@ #[cfg(feature="fixed_wide_traits")] pub mod wide; +#[cfg(all(feature="fixed_wide_traits",feature="deferred_division"))] +pub mod length; // Stolen from https://github.com/c1m50c/fixed-vectors (MIT license) #[doc(hidden)]