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

This commit is contained in:
Timothy Warren 2020-05-05 18:49:19 -04:00
parent e54485f12b
commit cf262073dd
1 changed files with 21 additions and 28 deletions

View File

@ -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)]