fixed_wide: annihilate non-euclid division

This commit is contained in:
2026-03-06 09:10:29 -08:00
parent 841ae94255
commit 4dab573a3c

View File

@@ -497,8 +497,8 @@ macro_rules! macro_16 {
macro_16!( impl_multiplicative_assign_operator_not_const_generic, (Fixed, MulAssign, mul_assign, mul) );
macro_16!( impl_multiply_operator_not_const_generic, (Fixed, Mul, mul, Self) );
macro_16!( impl_multiplicative_assign_operator_not_const_generic, (Fixed, DivAssign, div_assign, div) );
macro_16!( impl_divide_operator_not_const_generic, (Fixed, Div, div, Self) );
macro_16!( impl_multiplicative_assign_operator_not_const_generic, (Fixed, DivAssign, div_assign, div_euclid) );
macro_16!( impl_divide_operator_not_const_generic, (Fixed, Div, div_euclid, Self) );
impl_multiplicative_assign_operator!( Fixed, MulAssign, mul_assign, mul );
impl_multiplicative_operator!( Fixed, Mul, mul, mul, Self );
impl_multiplicative_assign_operator!( Fixed, DivAssign, div_assign, div_euclid );
@@ -605,7 +605,7 @@ macro_rules! impl_wide_not_const_generic{
// (lhs/2^LHS_FRAC)/(rhs/2^RHS_FRAC)
let lhs=self.bits.as_::<BInt<{$lhs+$rhs}>>().shl($rhs*64);
let rhs=rhs.bits.as_::<BInt<{$lhs+$rhs}>>();
Fixed::from_bits(lhs/rhs)
Fixed::from_bits(lhs.div_euclid(rhs))
}
}
}
@@ -641,7 +641,7 @@ macro_rules! impl_wide_same_size_not_const_generic{
// (lhs/2^LHS_FRAC)/(rhs/2^RHS_FRAC)
let lhs=self.bits.as_::<BInt<{$width*2}>>().shl($width*64);
let rhs=rhs.bits.as_::<BInt<{$width*2}>>();
Fixed::from_bits(lhs/rhs)
Fixed::from_bits(lhs.div_euclid(rhs))
}
}
}