@@ -100,8 +100,8 @@ fn unwrap<T>(t: Option<T>) -> T {
100100}
101101
102102macro_rules! int_impl_common {
103- ( $ty: ty, $bits : expr ) => {
104- const BITS : u32 = $bits ;
103+ ( $ty: ty) => {
104+ const BITS : u32 = < Self > :: BITS ;
105105
106106 const ZERO : Self = 0 ;
107107 const ONE : Self = 1 ;
@@ -232,7 +232,7 @@ macro_rules! int_impl_common {
232232}
233233
234234macro_rules! int_impl {
235- ( $ity: ty, $uty: ty, $bits : expr ) => {
235+ ( $ity: ty, $uty: ty) => {
236236 impl Int for $uty {
237237 type OtherSign = $ity;
238238 type UnsignedInt = $uty;
@@ -253,7 +253,7 @@ macro_rules! int_impl {
253253 ( self . wrapping_sub( other) as $ity) . wrapping_abs( ) as $uty
254254 }
255255
256- int_impl_common!( $uty, $bits ) ;
256+ int_impl_common!( $uty) ;
257257 }
258258
259259 impl Int for $ity {
@@ -280,17 +280,17 @@ macro_rules! int_impl {
280280 self . wrapping_sub( other) . wrapping_abs( ) as $uty
281281 }
282282
283- int_impl_common!( $ity, $bits ) ;
283+ int_impl_common!( $ity) ;
284284 }
285285 } ;
286286}
287287
288- int_impl ! ( isize , usize , usize :: MAX . count_ones ( ) ) ;
289- int_impl ! ( i8 , u8 , 8 ) ;
290- int_impl ! ( i16 , u16 , 16 ) ;
291- int_impl ! ( i32 , u32 , 32 ) ;
292- int_impl ! ( i64 , u64 , 64 ) ;
293- int_impl ! ( i128 , u128 , 128 ) ;
288+ int_impl ! ( isize , usize ) ;
289+ int_impl ! ( i8 , u8 ) ;
290+ int_impl ! ( i16 , u16 ) ;
291+ int_impl ! ( i32 , u32 ) ;
292+ int_impl ! ( i64 , u64 ) ;
293+ int_impl ! ( i128 , u128 ) ;
294294
295295/// Trait for integers twice the bit width of another integer. This is implemented for all
296296/// primitives except for `u8`, because there is not a smaller primitive.
0 commit comments