about summary refs log tree commit diff
path: root/src/libstd/num/i8.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-04-30 22:23:26 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-05-07 08:15:58 -0700
commitbe0a11729e5226a758261ba4f095978ef2105837 (patch)
tree12a0f2df31415c7f6aa507d6c08c77466aa8ed54 /src/libstd/num/i8.rs
parent0c302938866cbccdecdcd78b42bb46106fdfa28e (diff)
downloadrust-be0a11729e5226a758261ba4f095978ef2105837.tar.gz
rust-be0a11729e5226a758261ba4f095978ef2105837.zip
core: Inherit the specific numeric modules
This implements all traits inside of core::num for all the primitive types,
removing all the functionality from libstd. The std modules reexport all of the
necessary items from the core modules.
Diffstat (limited to 'src/libstd/num/i8.rs')
-rw-r--r--src/libstd/num/i8.rs61
1 files changed, 6 insertions, 55 deletions
diff --git a/src/libstd/num/i8.rs b/src/libstd/num/i8.rs
index 2d349fa7f4f..bd40a2c53b6 100644
--- a/src/libstd/num/i8.rs
+++ b/src/libstd/num/i8.rs
@@ -10,63 +10,14 @@
 
 //! Operations and constants for signed 8-bits integers (`i8` type)
 
-#![allow(non_uppercase_statics)]
-
-use prelude::*;
-
-use default::Default;
 use from_str::FromStr;
-use num::{Bitwise, Bounded, CheckedAdd, CheckedSub, CheckedMul};
-use num::{CheckedDiv, Zero, One, strconv};
+use iter::Iterator;
 use num::{ToStrRadix, FromStrRadix};
-use option::{Option, Some, None};
+use num::strconv;
+use option::Option;
+use slice::{ImmutableVector, OwnedVector};
 use str;
-use intrinsics;
-
-int_module!(i8, 8)
-
-impl Bitwise for i8 {
-    /// Returns the number of ones in the binary representation of the number.
-    #[inline]
-    fn count_ones(&self) -> i8 { unsafe { intrinsics::ctpop8(*self as u8) as i8 } }
-
-    /// Returns the number of leading zeros in the in the binary representation
-    /// of the number.
-    #[inline]
-    fn leading_zeros(&self) -> i8 { unsafe { intrinsics::ctlz8(*self as u8) as i8 } }
-
-    /// Returns the number of trailing zeros in the in the binary representation
-    /// of the number.
-    #[inline]
-    fn trailing_zeros(&self) -> i8 { unsafe { intrinsics::cttz8(*self as u8) as i8 } }
-}
-
-impl CheckedAdd for i8 {
-    #[inline]
-    fn checked_add(&self, v: &i8) -> Option<i8> {
-        unsafe {
-            let (x, y) = intrinsics::i8_add_with_overflow(*self, *v);
-            if y { None } else { Some(x) }
-        }
-    }
-}
 
-impl CheckedSub for i8 {
-    #[inline]
-    fn checked_sub(&self, v: &i8) -> Option<i8> {
-        unsafe {
-            let (x, y) = intrinsics::i8_sub_with_overflow(*self, *v);
-            if y { None } else { Some(x) }
-        }
-    }
-}
+pub use core::i8::{BITS, BYTES, MIN, MAX};
 
-impl CheckedMul for i8 {
-    #[inline]
-    fn checked_mul(&self, v: &i8) -> Option<i8> {
-        unsafe {
-            let (x, y) = intrinsics::i8_mul_with_overflow(*self, *v);
-            if y { None } else { Some(x) }
-        }
-    }
-}
+int_module!(i8)