/rust/registry/src/index.crates.io-1949cf8c6b5b557f/bnum-0.12.1/src/buint/cmp.rs
Line | Count | Source |
1 | | use core::cmp::{Ord, Ordering, PartialOrd}; |
2 | | |
3 | | macro_rules! cmp { |
4 | | ($BUint: ident, $BInt: ident, $Digit: ident) => { |
5 | | impl<const N: usize> PartialOrd for $BUint<N> { |
6 | | #[inline] |
7 | 0 | fn partial_cmp(&self, other: &Self) -> Option<Ordering> { |
8 | 0 | Some(self.cmp(other)) |
9 | 0 | } Unexecuted instantiation: <bnum::buint::BUint<_> as core::cmp::PartialOrd>::partial_cmp Unexecuted instantiation: <bnum::buint::BUintD32<_> as core::cmp::PartialOrd>::partial_cmp Unexecuted instantiation: <bnum::buint::BUintD16<_> as core::cmp::PartialOrd>::partial_cmp Unexecuted instantiation: <bnum::buint::BUintD8<_> as core::cmp::PartialOrd>::partial_cmp |
10 | | } |
11 | | |
12 | | impl<const N: usize> Ord for $BUint<N> { |
13 | | #[inline] |
14 | 0 | fn cmp(&self, other: &Self) -> Ordering { |
15 | 0 | Self::cmp(self, other) |
16 | 0 | } Unexecuted instantiation: <bnum::buint::BUintD32<_> as core::cmp::Ord>::cmp Unexecuted instantiation: <bnum::buint::BUintD16<_> as core::cmp::Ord>::cmp Unexecuted instantiation: <bnum::buint::BUintD8<_> as core::cmp::Ord>::cmp Unexecuted instantiation: <bnum::buint::BUint<_> as core::cmp::Ord>::cmp |
17 | | |
18 | | #[inline] |
19 | 0 | fn max(self, other: Self) -> Self { |
20 | 0 | Self::max(self, other) |
21 | 0 | } Unexecuted instantiation: <bnum::buint::BUintD32<_> as core::cmp::Ord>::max Unexecuted instantiation: <bnum::buint::BUintD16<_> as core::cmp::Ord>::max Unexecuted instantiation: <bnum::buint::BUintD8<_> as core::cmp::Ord>::max Unexecuted instantiation: <bnum::buint::BUint<_> as core::cmp::Ord>::max |
22 | | |
23 | | #[inline] |
24 | 0 | fn min(self, other: Self) -> Self { |
25 | 0 | Self::min(self, other) |
26 | 0 | } Unexecuted instantiation: <bnum::buint::BUintD32<_> as core::cmp::Ord>::min Unexecuted instantiation: <bnum::buint::BUintD16<_> as core::cmp::Ord>::min Unexecuted instantiation: <bnum::buint::BUintD8<_> as core::cmp::Ord>::min Unexecuted instantiation: <bnum::buint::BUint<_> as core::cmp::Ord>::min |
27 | | |
28 | | #[inline] |
29 | 0 | fn clamp(self, min: Self, max: Self) -> Self { |
30 | 0 | Self::clamp(self, min, max) |
31 | 0 | } Unexecuted instantiation: <bnum::buint::BUintD32<_> as core::cmp::Ord>::clamp Unexecuted instantiation: <bnum::buint::BUintD16<_> as core::cmp::Ord>::clamp Unexecuted instantiation: <bnum::buint::BUintD8<_> as core::cmp::Ord>::clamp Unexecuted instantiation: <bnum::buint::BUint<_> as core::cmp::Ord>::clamp |
32 | | } |
33 | | }; |
34 | | } |
35 | | |
36 | | #[cfg(test)] |
37 | | crate::test::all_digit_tests! { |
38 | | crate::int::cmp::tests!(utest); |
39 | | } |
40 | | |
41 | | crate::macro_impl!(cmp); |