use crate::gaussian_integer::GaussianInteger;
macro_rules! impl_unsigned {
($t: ident) => {
impl PartialEq<$t> for GaussianInteger {
#[inline]
fn eq(&self, other: &$t) -> bool {
self.imaginary == 0u32 && self.real == *other
}
}
impl PartialEq<GaussianInteger> for $t {
#[inline]
fn eq(&self, other: &GaussianInteger) -> bool {
other == self
}
}
};
}
apply_to_unsigneds!(impl_unsigned);
macro_rules! impl_signed {
($t: ident) => {
impl PartialEq<$t> for GaussianInteger {
#[inline]
fn eq(&self, other: &$t) -> bool {
self.imaginary == 0u32 && self.real == *other
}
}
impl PartialEq<GaussianInteger> for $t {
#[inline]
fn eq(&self, other: &GaussianInteger) -> bool {
other == self
}
}
};
}
apply_to_signeds!(impl_signed);