11macro_rules! macro_impl {
2- ( $INT: ident, $bits: literal, $sign: ident, $name: ident) => {
2+ ( $d : tt , $ INT: ident, $bits: literal, $sign: ident, $name: ident) => {
33 #[ macro_export]
44 #[ doc = concat!( "A macro to construct " , $bits, "-bit [`" , stringify!( $INT) , "`](crate::" , stringify!( $INT) , ") " , stringify!( $sign) , " integer from literals." ) ]
55 ///
@@ -16,28 +16,28 @@ macro_rules! macro_impl {
1616 /// ```
1717 ///
1818 macro_rules! $name {
19- ( $lit : expr ) => { {
20- const __INT: $crate:: $INT = $crate:: $INT:: parse_str( stringify!( $lit ) ) ;
19+ ( $d ( $d body : tt ) * ) => { {
20+ const __INT: $crate:: $INT = $crate:: $INT:: parse_str( concat! ( $d ( stringify!( $d body ) ) , * ) ) ;
2121 __INT
2222 } } ;
2323 }
2424 } ;
2525}
2626
27- macro_impl ! ( U64 , 64 , unsigned, u64 ) ;
28- macro_impl ! ( U128 , 128 , unsigned, u128 ) ;
29- macro_impl ! ( U256 , 256 , unsigned, u256) ;
30- macro_impl ! ( U512 , 512 , unsigned, u512) ;
31- macro_impl ! ( U1024 , 1024 , unsigned, u1024) ;
32- // macro_impl!(U2048, 2048, unsigned, u2048);
33- // macro_impl!(U4096, 4096, unsigned, u4096);
34- // macro_impl!(U8192, 8192, unsigned, u8192);
27+ macro_impl ! ( $ , U64 , 64 , unsigned, u64 ) ;
28+ macro_impl ! ( $ , U128 , 128 , unsigned, u128 ) ;
29+ macro_impl ! ( $ , U256 , 256 , unsigned, u256) ;
30+ macro_impl ! ( $ , U512 , 512 , unsigned, u512) ;
31+ macro_impl ! ( $ , U1024 , 1024 , unsigned, u1024) ;
32+ // macro_impl!($, U2048, 2048, unsigned, u2048);
33+ // macro_impl!($, U4096, 4096, unsigned, u4096);
34+ // macro_impl!($, U8192, 8192, unsigned, u8192);
3535
36- macro_impl ! ( I64 , 64 , signed, i64 ) ;
37- macro_impl ! ( I128 , 128 , signed, i128 ) ;
38- macro_impl ! ( I256 , 256 , signed, i256) ;
39- macro_impl ! ( I512 , 512 , signed, i512) ;
40- macro_impl ! ( I1024 , 1024 , signed, i1024) ;
41- // macro_impl!(I2048, 2048, signed, i2048);
42- // macro_impl!(I4096, 4096, signed, i4096);
43- // macro_impl!(I8192, 8192, signed, i8192);
36+ macro_impl ! ( $ , I64 , 64 , signed, i64 ) ;
37+ macro_impl ! ( $ , I128 , 128 , signed, i128 ) ;
38+ macro_impl ! ( $ , I256 , 256 , signed, i256) ;
39+ macro_impl ! ( $ , I512 , 512 , signed, i512) ;
40+ macro_impl ! ( $ , I1024 , 1024 , signed, i1024) ;
41+ // macro_impl!($, I2048, 2048, signed, i2048);
42+ // macro_impl!($, I4096, 4096, signed, i4096);
43+ // macro_impl!($, I8192, 8192, signed, i8192);
0 commit comments