macro_rules! impl_bin_op {
($trait:ident, $fn:ident, $trait_assign:ident, $fn_assign:ident, $fdel:ident) => {
impl<const BITS: usize, const LIMBS: usize> $trait_assign<Uint<BITS, LIMBS>>
for Uint<BITS, LIMBS>
{
#[allow(clippy::inline_always)]
#[inline(always)]
#[track_caller]
fn $fn_assign(&mut self, rhs: Uint<BITS, LIMBS>) {
*self = self.$fdel(rhs);
}
}
impl<const BITS: usize, const LIMBS: usize> $trait_assign<&Uint<BITS, LIMBS>>
for Uint<BITS, LIMBS>
{
#[allow(clippy::inline_always)]
#[inline(always)]
#[track_caller]
fn $fn_assign(&mut self, rhs: &Uint<BITS, LIMBS>) {
*self = self.$fdel(*rhs);
}
}
impl<const BITS: usize, const LIMBS: usize> $trait<Uint<BITS, LIMBS>>
for Uint<BITS, LIMBS>
{
type Output = Uint<BITS, LIMBS>;
#[allow(clippy::inline_always)]
#[inline(always)]
#[track_caller]
fn $fn(self, rhs: Uint<BITS, LIMBS>) -> Self::Output {
self.$fdel(rhs)
}
}
impl<const BITS: usize, const LIMBS: usize> $trait<&Uint<BITS, LIMBS>>
for Uint<BITS, LIMBS>
{
type Output = Uint<BITS, LIMBS>;
#[allow(clippy::inline_always)]
#[inline(always)]
#[track_caller]
fn $fn(self, rhs: &Uint<BITS, LIMBS>) -> Self::Output {
self.$fdel(*rhs)
}
}
impl<const BITS: usize, const LIMBS: usize> $trait<Uint<BITS, LIMBS>>
for &Uint<BITS, LIMBS>
{
type Output = Uint<BITS, LIMBS>;
#[allow(clippy::inline_always)]
#[inline(always)]
#[track_caller]
fn $fn(self, rhs: Uint<BITS, LIMBS>) -> Self::Output {
self.$fdel(rhs)
}
}
impl<const BITS: usize, const LIMBS: usize> $trait<&Uint<BITS, LIMBS>>
for &Uint<BITS, LIMBS>
{
type Output = Uint<BITS, LIMBS>;
#[allow(clippy::inline_always)]
#[inline(always)]
#[track_caller]
fn $fn(self, rhs: &Uint<BITS, LIMBS>) -> Self::Output {
self.$fdel(*rhs)
}
}
};
}