@@ -94,9 +94,9 @@ macro_rules! sh_impl_signed {
9494 #[ inline]
9595 fn shl( self , other: $f) -> Wrapping <$t> {
9696 if other < 0 {
97- Wrapping ( self . 0 . wrapping_shr( ( -other & self :: shift_max :: $t as $f ) as u32 ) )
97+ Wrapping ( self . 0 . wrapping_shr( -other as u32 ) )
9898 } else {
99- Wrapping ( self . 0 . wrapping_shl( ( other & self :: shift_max :: $t as $f ) as u32 ) )
99+ Wrapping ( self . 0 . wrapping_shl( other as u32 ) )
100100 }
101101 }
102102 }
@@ -119,9 +119,9 @@ macro_rules! sh_impl_signed {
119119 #[ inline]
120120 fn shr( self , other: $f) -> Wrapping <$t> {
121121 if other < 0 {
122- Wrapping ( self . 0 . wrapping_shl( ( -other & self :: shift_max :: $t as $f ) as u32 ) )
122+ Wrapping ( self . 0 . wrapping_shl( -other as u32 ) )
123123 } else {
124- Wrapping ( self . 0 . wrapping_shr( ( other & self :: shift_max :: $t as $f ) as u32 ) )
124+ Wrapping ( self . 0 . wrapping_shr( other as u32 ) )
125125 }
126126 }
127127 }
@@ -147,7 +147,7 @@ macro_rules! sh_impl_unsigned {
147147
148148 #[ inline]
149149 fn shl( self , other: $f) -> Wrapping <$t> {
150- Wrapping ( self . 0 . wrapping_shl( ( other & self :: shift_max :: $t as $f ) as u32 ) )
150+ Wrapping ( self . 0 . wrapping_shl( other as u32 ) )
151151 }
152152 }
153153 forward_ref_binop! { impl Shl , shl for Wrapping <$t>, $f,
@@ -157,7 +157,7 @@ macro_rules! sh_impl_unsigned {
157157 impl ShlAssign <$f> for Wrapping <$t> {
158158 #[ inline]
159159 fn shl_assign( & mut self , other: $f) {
160- * self = * self << other;
160+ * self <<= other;
161161 }
162162 }
163163 forward_ref_op_assign! { impl ShlAssign , shl_assign for Wrapping <$t>, $f }
@@ -168,7 +168,7 @@ macro_rules! sh_impl_unsigned {
168168
169169 #[ inline]
170170 fn shr( self , other: $f) -> Wrapping <$t> {
171- Wrapping ( self . 0 . wrapping_shr( ( other & self :: shift_max :: $t as $f ) as u32 ) )
171+ Wrapping ( self . 0 . wrapping_shr( other as u32 ) )
172172 }
173173 }
174174 forward_ref_binop! { impl Shr , shr for Wrapping <$t>, $f,
@@ -178,7 +178,7 @@ macro_rules! sh_impl_unsigned {
178178 impl ShrAssign <$f> for Wrapping <$t> {
179179 #[ inline]
180180 fn shr_assign( & mut self , other: $f) {
181- * self = * self >> other;
181+ * self >>= other;
182182 }
183183 }
184184 forward_ref_op_assign! { impl ShrAssign , shr_assign for Wrapping <$t>, $f }
@@ -1052,39 +1052,3 @@ macro_rules! wrapping_int_impl_unsigned {
10521052}
10531053
10541054wrapping_int_impl_unsigned ! { usize u8 u16 u32 u64 u128 }
1055-
1056- mod shift_max {
1057- #![ allow( non_upper_case_globals) ]
1058-
1059- #[ cfg( target_pointer_width = "16" ) ]
1060- mod platform {
1061- pub ( crate ) const usize: u32 = super :: u16;
1062- pub ( crate ) const isize: u32 = super :: i16;
1063- }
1064-
1065- #[ cfg( target_pointer_width = "32" ) ]
1066- mod platform {
1067- pub ( crate ) const usize: u32 = super :: u32;
1068- pub ( crate ) const isize: u32 = super :: i32;
1069- }
1070-
1071- #[ cfg( target_pointer_width = "64" ) ]
1072- mod platform {
1073- pub ( crate ) const usize: u32 = super :: u64;
1074- pub ( crate ) const isize: u32 = super :: i64;
1075- }
1076-
1077- pub ( super ) const i8: u32 = ( 1 << 3 ) - 1 ;
1078- pub ( super ) const i16: u32 = ( 1 << 4 ) - 1 ;
1079- pub ( super ) const i32: u32 = ( 1 << 5 ) - 1 ;
1080- pub ( super ) const i64: u32 = ( 1 << 6 ) - 1 ;
1081- pub ( super ) const i128: u32 = ( 1 << 7 ) - 1 ;
1082- pub ( super ) use self :: platform:: isize;
1083-
1084- pub ( super ) const u8: u32 = i8;
1085- pub ( super ) const u16: u32 = i16;
1086- pub ( super ) const u32: u32 = i32;
1087- pub ( super ) const u64: u32 = i64;
1088- pub ( super ) const u128: u32 = i128;
1089- pub ( super ) use self :: platform:: usize;
1090- }
0 commit comments