From 3f0900b0ecf4ef15afcd15f0d2a8e4bdf642fb1b Mon Sep 17 00:00:00 2001 From: Quaternions Date: Mon, 9 Sep 2024 15:17:32 -0700 Subject: [PATCH] ratio stuff --- fixed_wide/src/fixed.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fixed_wide/src/fixed.rs b/fixed_wide/src/fixed.rs index d35046b..561b26f 100644 --- a/fixed_wide/src/fixed.rs +++ b/fixed_wide/src/fixed.rs @@ -195,7 +195,7 @@ macro_rules! impl_divide_operator_not_const_generic { } } } - #[cfg(not(feature="wide-mul"))] + #[cfg(all(not(feature="wide-mul"),not(feature="ratio")))] impl_multiplicative_operator_not_const_generic!(($struct, $trait, $method, $output ), $width); }; } @@ -253,6 +253,13 @@ impl_multiplicative_assign_operator!( Fixed, MulAssign, mul_assign ); impl_multiplicative_operator!( Fixed, Mul, mul, Self ); impl_multiplicative_assign_operator!( Fixed, DivAssign, div_assign ); impl_multiplicative_operator!( Fixed, Div, div, Self ); +#[cfg(feature="ratio")] +impl core::ops::Div> for Fixed{ + type Output=crate::ratio::Ratio,Fixed>; + fn div(self, other: Fixed)->Self::Output{ + crate::ratio::Ratio::new(self,other) + } +} // wide operators. The result width is the sum of the input widths, i.e. none of the multiplication