@@ -94,9 +94,9 @@ macro_rules! sh_impl_signed {
94
94
#[ inline]
95
95
fn shl( self , other: $f) -> Wrapping <$t> {
96
96
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 ) )
98
98
} 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 ) )
100
100
}
101
101
}
102
102
}
@@ -119,9 +119,9 @@ macro_rules! sh_impl_signed {
119
119
#[ inline]
120
120
fn shr( self , other: $f) -> Wrapping <$t> {
121
121
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 ) )
123
123
} 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 ) )
125
125
}
126
126
}
127
127
}
@@ -147,7 +147,7 @@ macro_rules! sh_impl_unsigned {
147
147
148
148
#[ inline]
149
149
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 ) )
151
151
}
152
152
}
153
153
forward_ref_binop! { impl Shl , shl for Wrapping <$t>, $f,
@@ -168,7 +168,7 @@ macro_rules! sh_impl_unsigned {
168
168
169
169
#[ inline]
170
170
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 ) )
172
172
}
173
173
}
174
174
forward_ref_binop! { impl Shr , shr for Wrapping <$t>, $f,
@@ -1052,39 +1052,3 @@ macro_rules! wrapping_int_impl_unsigned {
1052
1052
}
1053
1053
1054
1054
wrapping_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