1use core::cmp::{Ord, Ordering, PartialOrd};
2
3macro_rules! cmp {
4 ($BUint: ident, $BInt: ident, $Digit: ident) => {
5 impl<const N: usize> PartialOrd for $BUint<N> {
6 #[inline]
7 fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
8 Some(self.cmp(other))
9 }
10 }
11
12 impl<const N: usize> Ord for $BUint<N> {
13 #[inline]
14 fn cmp(&self, other: &Self) -> Ordering {
15 Self::cmp(self, other)
16 }
17
18 #[inline]
19 fn max(self, other: Self) -> Self {
20 Self::max(self, other)
21 }
22
23 #[inline]
24 fn min(self, other: Self) -> Self {
25 Self::min(self, other)
26 }
27
28 #[inline]
29 fn clamp(self, min: Self, max: Self) -> Self {
30 Self::clamp(self, min, max)
31 }
32 }
33 };
34}
35
36#[cfg(test)]
37crate::test::all_digit_tests! {
38 crate::int::cmp::tests!(utest);
39}
40
41crate::macro_impl!(cmp);