about summary refs log tree commit diff
path: root/src/libcore/num/i16.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-05-28 12:41:40 -0700
committerbors <bors@rust-lang.org>2014-05-28 12:41:40 -0700
commite865415c2fe2c0e83fe1955238db082a1374c380 (patch)
tree0e0ab6993ac13addc61cef0e3c8ffd0b5a09725a /src/libcore/num/i16.rs
parent98c2b4b4ac7a110aee7c236f5d5c392dc7617a03 (diff)
parentdd0d495f50e2d8ba501e6b003cb4c1ef52d95ed5 (diff)
auto merge of #14464 : Sawyer47/rust/issue-12925, r=alexcrichton
This is an attempt of fixing #12925.

This PR moves almost all trait implementations for primitive types ((), bool, char, i*, u*, f*) near trait definitions. Only Float trait implementations weren't moved because they heavily rely on constants defined in f32.rs and f64.rs.

Some trait implementations had cfg(not(test)) attribute. I suspect it's because of issue 2912.
Still, someone who knows the problem better should probably check this code.

Closes #12925
Diffstat (limited to 'src/libcore/num/i16.rs')
-rw-r--r--src/libcore/num/i16.rs58
1 files changed, 0 insertions, 58 deletions
diff --git a/src/libcore/num/i16.rs b/src/libcore/num/i16.rs
index 361f75b9e88..957e585e71c 100644
--- a/src/libcore/num/i16.rs
+++ b/src/libcore/num/i16.rs
@@ -10,63 +10,5 @@
 
 //! Operations and constants for signed 16-bits integers (`i16` type)
 
-use default::Default;
-use intrinsics;
-use num::{Bitwise, Bounded, Zero, One, Signed, Num, Primitive, Int};
-use num::{CheckedDiv, CheckedAdd, CheckedSub, CheckedMul};
-use option::{Option, Some, None};
-
-#[cfg(not(test))]
-use cmp::{Eq, Ord, TotalEq, TotalOrd, Less, Greater, Equal, Ordering};
-#[cfg(not(test))]
-use ops::{Add, Sub, Mul, Div, Rem, Neg, BitOr, BitAnd, BitXor};
-#[cfg(not(test))]
-use ops::{Shl, Shr, Not};
-
 int_module!(i16, 16)
 
-impl Bitwise for i16 {
-    /// Returns the number of ones in the binary representation of the number.
-    #[inline]
-    fn count_ones(&self) -> i16 { unsafe { intrinsics::ctpop16(*self as u16) as i16 } }
-
-    /// Returns the number of leading zeros in the in the binary representation
-    /// of the number.
-    #[inline]
-    fn leading_zeros(&self) -> i16 { unsafe { intrinsics::ctlz16(*self as u16) as i16 } }
-
-    /// Returns the number of trailing zeros in the in the binary representation
-    /// of the number.
-    #[inline]
-    fn trailing_zeros(&self) -> i16 { unsafe { intrinsics::cttz16(*self as u16) as i16 } }
-}
-
-impl CheckedAdd for i16 {
-    #[inline]
-    fn checked_add(&self, v: &i16) -> Option<i16> {
-        unsafe {
-            let (x, y) = intrinsics::i16_add_with_overflow(*self, *v);
-            if y { None } else { Some(x) }
-        }
-    }
-}
-
-impl CheckedSub for i16 {
-    #[inline]
-    fn checked_sub(&self, v: &i16) -> Option<i16> {
-        unsafe {
-            let (x, y) = intrinsics::i16_sub_with_overflow(*self, *v);
-            if y { None } else { Some(x) }
-        }
-    }
-}
-
-impl CheckedMul for i16 {
-    #[inline]
-    fn checked_mul(&self, v: &i16) -> Option<i16> {
-        unsafe {
-            let (x, y) = intrinsics::i16_mul_with_overflow(*self, *v);
-            if y { None } else { Some(x) }
-        }
-    }
-}