diff options
Diffstat (limited to 'src/libcore/num/uint.rs')
| -rw-r--r-- | src/libcore/num/uint.rs | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/src/libcore/num/uint.rs b/src/libcore/num/uint.rs index f988650cc01..99ed7e10bf9 100644 --- a/src/libcore/num/uint.rs +++ b/src/libcore/num/uint.rs @@ -10,83 +10,5 @@ //! Operations and constants for architecture-sized unsigned integers (`uint` 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!(uint, int, ::int::BITS) -#[cfg(target_word_size = "32")] -impl CheckedAdd for uint { - #[inline] - fn checked_add(&self, v: &uint) -> Option<uint> { - unsafe { - let (x, y) = intrinsics::u32_add_with_overflow(*self as u32, *v as u32); - if y { None } else { Some(x as uint) } - } - } -} - -#[cfg(target_word_size = "64")] -impl CheckedAdd for uint { - #[inline] - fn checked_add(&self, v: &uint) -> Option<uint> { - unsafe { - let (x, y) = intrinsics::u64_add_with_overflow(*self as u64, *v as u64); - if y { None } else { Some(x as uint) } - } - } -} - -#[cfg(target_word_size = "32")] -impl CheckedSub for uint { - #[inline] - fn checked_sub(&self, v: &uint) -> Option<uint> { - unsafe { - let (x, y) = intrinsics::u32_sub_with_overflow(*self as u32, *v as u32); - if y { None } else { Some(x as uint) } - } - } -} - -#[cfg(target_word_size = "64")] -impl CheckedSub for uint { - #[inline] - fn checked_sub(&self, v: &uint) -> Option<uint> { - unsafe { - let (x, y) = intrinsics::u64_sub_with_overflow(*self as u64, *v as u64); - if y { None } else { Some(x as uint) } - } - } -} - -#[cfg(target_word_size = "32")] -impl CheckedMul for uint { - #[inline] - fn checked_mul(&self, v: &uint) -> Option<uint> { - unsafe { - let (x, y) = intrinsics::u32_mul_with_overflow(*self as u32, *v as u32); - if y { None } else { Some(x as uint) } - } - } -} - -#[cfg(target_word_size = "64")] -impl CheckedMul for uint { - #[inline] - fn checked_mul(&self, v: &uint) -> Option<uint> { - unsafe { - let (x, y) = intrinsics::u64_mul_with_overflow(*self as u64, *v as u64); - if y { None } else { Some(x as uint) } - } - } -} |
