Simplify PortalOrd macro
Some checks failed
timw4mail/rusty-numbers/pipeline/head There was a failure building this commit

This commit is contained in:
Timothy Warren 2020-05-05 18:49:19 -04:00
parent e54485f12b
commit cf262073dd

View File

@ -489,8 +489,7 @@ macro_rules! impl_from_larger {
} }
macro_rules! impl_ord_literal { macro_rules! impl_ord_literal {
($(($($prim: ty),+), $base: ty), *) => { ($($prim: ty),+) => {
$(
$( $(
impl PartialEq<$prim> for BigInt { impl PartialEq<$prim> for BigInt {
fn eq(&self, other: &$prim) -> bool { 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)); impl_from_larger!((i64, u64), (i128, u128));
#[cfg(target_pointer_width = "32")] #[cfg(target_pointer_width = "32")]
impl_from_smaller!((i8, u8), (i16, u16), (i32, u32)); 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")] #[cfg(target_pointer_width = "64")]
impl_from_larger!((i128, u128)); impl_from_larger!((i128, u128));
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
impl_from_smaller!((i8, u8), (i16, u16), (i32, u32), (i64, u64)); 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); // Implement PartialEq and PartialOrd to compare against BigInt values
#[cfg(target_pointer_width = "64")] impl_ord_literal!(i8,u8,i16,u16,i32,u32,i64,u64,i128,u128);
static BITS: usize = 64;
#[cfg(test)] #[cfg(test)]
#[cfg_attr(tarpaulin, skip)] #[cfg_attr(tarpaulin, skip)]