From 2d87e4b5cca34d078100201e8b720666ec928e06 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 27 Aug 2024 14:23:53 -0700 Subject: [PATCH] vectors: min, max --- fixed_wide_vectors/src/macros/mod.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/fixed_wide_vectors/src/macros/mod.rs b/fixed_wide_vectors/src/macros/mod.rs index 0d899e2..caedc19 100644 --- a/fixed_wide_vectors/src/macros/mod.rs +++ b/fixed_wide_vectors/src/macros/mod.rs @@ -166,6 +166,19 @@ macro_rules! impl_vector { } } + impl $struct { + pub fn min(self, rhs: Self) -> $struct { + $struct{ + $( $field: self.$field.min(rhs.$field) ), + + } + } + pub fn max(self, rhs: Self) -> $struct { + $struct{ + $( $field: self.$field.max(rhs.$field) ), + + } + } + } + impl> core::ops::Neg for $struct { type Output = Self;