allow simple ops (why did this not work before?)

This commit is contained in:
Quaternions 2024-08-28 12:17:25 -07:00
parent 8aa7da6be7
commit 68d1c23cfa

View File

@ -68,6 +68,19 @@ macro_rules! impl_operator {
}
}
}
impl<const CHUNKS:usize,Frac:Unsigned,U> core::ops::$trait<U> for $struct<CHUNKS,Frac>
where
BInt::<CHUNKS>:From<U>,
{
type Output = $output;
fn $method(self, other: U) -> Self::Output {
Self {
bits:self.bits.$method(BInt::<CHUNKS>::from(other)<<Frac::U32),
frac:PhantomData,
}
}
}
};
}
macro_rules! impl_assign_operator {
@ -77,6 +90,14 @@ macro_rules! impl_assign_operator {
self.bits.$method(other.bits);
}
}
impl<const CHUNKS:usize,Frac:Unsigned,U> core::ops::$trait<U> for $struct<CHUNKS,Frac>
where
BInt::<CHUNKS>:From<U>,
{
fn $method(&mut self, other: U) {
self.bits.$method(BInt::<CHUNKS>::from(other)<<Frac::U32);
}
}
};
}