use crate::num::basic::unsigneds::PrimitiveUnsigned;
use crate::unsigned_polynomial::UnsignedPolynomial;
use core::cmp::Ordering::{self, *};
impl<T: PrimitiveUnsigned> PartialOrd for UnsignedPolynomial<T> {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl<T: PrimitiveUnsigned> Ord for UnsignedPolynomial<T> {
fn cmp(&self, other: &Self) -> Ordering {
if core::ptr::eq(self, other) {
return Equal;
}
self.coefficients
.len()
.cmp(&other.coefficients.len())
.then_with(|| {
self.coefficients
.iter()
.rev()
.cmp(other.coefficients.iter().rev())
})
}
}