use crate::num::basic::unsigneds::PrimitiveUnsigned;
use crate::unsigned_polynomial::UnsignedPolynomial;
impl<T: PrimitiveUnsigned> PartialEq<T> for UnsignedPolynomial<T> {
fn eq(&self, other: &T) -> bool {
match self.coefficients.as_slice() {
[] => *other == T::ZERO,
[c] => c == other,
_ => false,
}
}
}
macro_rules! impl_partial_eq_unsigned {
($t: ident) => {
impl PartialEq<UnsignedPolynomial<$t>> for $t {
#[inline]
fn eq(&self, other: &UnsignedPolynomial<$t>) -> bool {
other == self
}
}
};
}
apply_to_unsigneds!(impl_partial_eq_unsigned);