Simplify PortalOrd macro
Some checks failed
timw4mail/rusty-numbers/pipeline/head There was a failure building this commit
Some checks failed
timw4mail/rusty-numbers/pipeline/head There was a failure building this commit
This commit is contained in:
parent
e54485f12b
commit
cf262073dd
@ -489,8 +489,7 @@ macro_rules! impl_from_larger {
|
||||
}
|
||||
|
||||
macro_rules! impl_ord_literal {
|
||||
($(($($prim: ty),+), $base: ty), *) => {
|
||||
$(
|
||||
($($prim: ty),+) => {
|
||||
$(
|
||||
impl PartialEq<$prim> for BigInt {
|
||||
fn eq(&self, other: &$prim) -> bool {
|
||||
@ -516,7 +515,6 @@ macro_rules! impl_ord_literal {
|
||||
}
|
||||
}
|
||||
)+
|
||||
)*
|
||||
};
|
||||
}
|
||||
|
||||
@ -524,19 +522,14 @@ macro_rules! impl_ord_literal {
|
||||
impl_from_larger!((i64, u64), (i128, u128));
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
impl_from_smaller!((i8, u8), (i16, u16), (i32, u32));
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
impl_ord_literal!((i8,u8,i16,u16,i32,u32,i64,u64), u32);
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
static BITS: usize = 32;
|
||||
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
impl_from_larger!((i128, u128));
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
impl_from_smaller!((i8, u8), (i16, u16), (i32, u32), (i64, u64));
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
impl_ord_literal!((i8,u8,i16,u16,i32,u32,i64,u64), u32);
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
static BITS: usize = 64;
|
||||
|
||||
// Implement PartialEq and PartialOrd to compare against BigInt values
|
||||
impl_ord_literal!(i8,u8,i16,u16,i32,u32,i64,u64,i128,u128);
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg_attr(tarpaulin, skip)]
|
||||
|
Loading…
Reference in New Issue
Block a user