diff options
| author | Nicholas Mazzuca <npmazzuca@gmail.com> | 2016-01-05 22:16:03 -0800 |
|---|---|---|
| committer | Nicholas Mazzuca <npmazzuca@gmail.com> | 2016-01-05 22:16:03 -0800 |
| commit | 14e1e2aee812978c81d4edf23359e7dca444d678 (patch) | |
| tree | b3fcaf4c02e187e91e5d223a73c5a917a39e5dca /src/libcore/num | |
| parent | bd58fd8438bd906c8e87b98218a605db84d42c68 (diff) | |
| download | rust-14e1e2aee812978c81d4edf23359e7dca444d678.tar.gz rust-14e1e2aee812978c81d4edf23359e7dca444d678.zip | |
Fix a breaking change in #30523
While this does fix a breaking change, it is also, technically, a [breaking-change] to go back to our original way
Diffstat (limited to 'src/libcore/num')
| -rw-r--r-- | src/libcore/num/wrapping.rs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/libcore/num/wrapping.rs b/src/libcore/num/wrapping.rs index 72f0d77f68b..8f9e38bbdf9 100644 --- a/src/libcore/num/wrapping.rs +++ b/src/libcore/num/wrapping.rs @@ -42,9 +42,9 @@ macro_rules! sh_impl_signed { #[inline(always)] fn shl(self, other: $f) -> Wrapping<$t> { if other < 0 { - Wrapping(self.0 >> (-other & self::shift_max::$t as $f)) + Wrapping(self.0.wrapping_shr((-other & self::shift_max::$t as $f) as u32)) } else { - Wrapping(self.0 << (other & self::shift_max::$t as $f)) + Wrapping(self.0.wrapping_shl((other & self::shift_max::$t as $f) as u32)) } } } @@ -64,9 +64,9 @@ macro_rules! sh_impl_signed { #[inline(always)] fn shr(self, other: $f) -> Wrapping<$t> { if other < 0 { - Wrapping(self.0 << (-other & self::shift_max::$t as $f)) + Wrapping(self.0.wrapping_shl((-other & self::shift_max::$t as $f) as u32)) } else { - Wrapping(self.0 >> (other & self::shift_max::$t as $f)) + Wrapping(self.0.wrapping_shr((other & self::shift_max::$t as $f) as u32)) } } } @@ -89,7 +89,7 @@ macro_rules! sh_impl_unsigned { #[inline(always)] fn shl(self, other: $f) -> Wrapping<$t> { - Wrapping(self.0 << (other & self::shift_max::$t as $f)) + Wrapping(self.0.wrapping_shl((other & self::shift_max::$t as $f) as u32)) } } @@ -107,7 +107,7 @@ macro_rules! sh_impl_unsigned { #[inline(always)] fn shr(self, other: $f) -> Wrapping<$t> { - Wrapping(self.0 >> (other & self::shift_max::$t as $f)) + Wrapping(self.0.wrapping_shr((other & self::shift_max::$t as $f) as u32)) } } @@ -124,17 +124,17 @@ macro_rules! sh_impl_unsigned { // FIXME (#23545): uncomment the remaining impls macro_rules! sh_impl_all { ($($t:ident)*) => ($( - sh_impl_unsigned! { $t, u8 } - sh_impl_unsigned! { $t, u16 } - sh_impl_unsigned! { $t, u32 } - sh_impl_unsigned! { $t, u64 } + //sh_impl_unsigned! { $t, u8 } + //sh_impl_unsigned! { $t, u16 } + //sh_impl_unsigned! { $t, u32 } + //sh_impl_unsigned! { $t, u64 } sh_impl_unsigned! { $t, usize } - sh_impl_signed! { $t, i8 } - sh_impl_signed! { $t, i16 } - sh_impl_signed! { $t, i32 } - sh_impl_signed! { $t, i64 } - sh_impl_signed! { $t, isize } + //sh_impl_signed! { $t, i8 } + //sh_impl_signed! { $t, i16 } + //sh_impl_signed! { $t, i32 } + //sh_impl_signed! { $t, i64 } + //sh_impl_signed! { $t, isize } )*) } |
