From da5decb2f70dbbe7e92babea110be23c80dfc835 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Mon, 26 Aug 2024 15:57:02 -0700 Subject: [PATCH] faster with less convenience --- fixed_wide/src/wide.rs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/fixed_wide/src/wide.rs b/fixed_wide/src/wide.rs index 09cb448..7944395 100644 --- a/fixed_wide/src/wide.rs +++ b/fixed_wide/src/wide.rs @@ -29,16 +29,13 @@ impl PartialEq for Fixed{ impl Eq for Fixed{} macro_rules! impl_operator { - ( $struct: ident, $trait: ident, $method: ident, $output: ty ) => { - impl core::ops::$trait for $struct - where - $struct:From - { + ( $struct: ident, $trait: ident, $method: ident, $output: ty ) => { + impl core::ops::$trait<$struct> for $struct{ type Output = $output; - fn $method(self, other: T) -> Self::Output { + fn $method(self, other: Self) -> Self::Output { Self { - bits:self.bits.$method($struct::::from(other).bits), + bits:self.bits.$method(other.bits), frac:PhantomData, } } @@ -47,12 +44,9 @@ macro_rules! impl_operator { } macro_rules! impl_assign_operator { ( $struct: ident, $trait: ident, $method: ident ) => { - impl core::ops::$trait for $struct - where - $struct:From - { - fn $method(&mut self, other: T) { - self.bits.$method($struct::::from(other).bits); + impl core::ops::$trait<$struct> for $struct{ + fn $method(&mut self, other: Self) { + self.bits.$method(other.bits); } } };