diff options
| author | Piotr Jawniak <sawyer47@gmail.com> | 2014-05-26 19:33:04 +0200 |
|---|---|---|
| committer | Piotr Jawniak <sawyer47@gmail.com> | 2014-05-28 17:15:35 +0200 |
| commit | dd0d495f50e2d8ba501e6b003cb4c1ef52d95ed5 (patch) | |
| tree | 1b1f2111b7c14249b9c17593e3f6b7ddae5f827d /src/libcore/num/u16.rs | |
| parent | a1838295eb3a8086e6022d030a1e9e1b08ecc812 (diff) | |
| download | rust-dd0d495f50e2d8ba501e6b003cb4c1ef52d95ed5.tar.gz rust-dd0d495f50e2d8ba501e6b003cb4c1ef52d95ed5.zip | |
Move trait impls for primitives near trait definition
Closes #12925
Diffstat (limited to 'src/libcore/num/u16.rs')
| -rw-r--r-- | src/libcore/num/u16.rs | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/src/libcore/num/u16.rs b/src/libcore/num/u16.rs index 96db898e3b0..b3c701115c5 100644 --- a/src/libcore/num/u16.rs +++ b/src/libcore/num/u16.rs @@ -10,47 +10,4 @@ //! Operations and constants for unsigned 16-bits integers (`u16` type) -use default::Default; -use intrinsics; -use num::{Bitwise, Bounded, Zero, One, Unsigned, Num, Int, Primitive}; -use num::{CheckedAdd, CheckedSub, CheckedMul, CheckedDiv}; -use option::{Some, None, Option}; - -#[cfg(not(test))] -use cmp::{Eq, Ord, TotalEq, TotalOrd, Less, Greater, Equal, Ordering}; -#[cfg(not(test))] -use ops::{Add, Sub, Mul, Div, Rem, Neg, BitAnd, BitOr, BitXor}; -#[cfg(not(test))] -use ops::{Shl, Shr, Not}; - uint_module!(u16, i16, 16) - -impl CheckedAdd for u16 { - #[inline] - fn checked_add(&self, v: &u16) -> Option<u16> { - unsafe { - let (x, y) = intrinsics::u16_add_with_overflow(*self, *v); - if y { None } else { Some(x) } - } - } -} - -impl CheckedSub for u16 { - #[inline] - fn checked_sub(&self, v: &u16) -> Option<u16> { - unsafe { - let (x, y) = intrinsics::u16_sub_with_overflow(*self, *v); - if y { None } else { Some(x) } - } - } -} - -impl CheckedMul for u16 { - #[inline] - fn checked_mul(&self, v: &u16) -> Option<u16> { - unsafe { - let (x, y) = intrinsics::u16_mul_with_overflow(*self, *v); - if y { None } else { Some(x) } - } - } -} |
