diff options
Diffstat (limited to 'libcore/num/wrapping.rs')
| -rw-r--r-- | libcore/num/wrapping.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libcore/num/wrapping.rs b/libcore/num/wrapping.rs index e28a36a..4857817 100644 --- a/libcore/num/wrapping.rs +++ b/libcore/num/wrapping.rs @@ -275,6 +275,15 @@ macro_rules! wrapping_impl { *self = *self & other; } } + + #[stable(feature = "wrapping_neg", since = "1.10.0")] + impl Neg for Wrapping<$t> { + type Output = Self; + #[inline(always)] + fn neg(self) -> Self { + Wrapping(0) - self + } + } )*) } @@ -283,6 +292,12 @@ wrapping_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 } mod shift_max { #![allow(non_upper_case_globals)] + #[cfg(target_pointer_width = "16")] + mod platform { + pub const usize: u32 = super::u16; + pub const isize: u32 = super::i16; + } + #[cfg(target_pointer_width = "32")] mod platform { pub const usize: u32 = super::u32; |