diff options
| -rw-r--r-- | src/libcore/num/int-template/int.rs | 41 | ||||
| -rw-r--r-- | src/libcore/num/uint-template/uint.rs | 41 |
2 files changed, 0 insertions, 82 deletions
diff --git a/src/libcore/num/int-template/int.rs b/src/libcore/num/int-template/int.rs index bfe8bd0bfe6..c04e2a2e70d 100644 --- a/src/libcore/num/int-template/int.rs +++ b/src/libcore/num/int-template/int.rs @@ -27,12 +27,6 @@ mod inst { #[inline(always)] fn bits() -> uint { 64 } - // fallback if we don't have access to the current word size - #[cfg(not(target_word_size = "32"), - not(target_word_size = "64"))] - #[inline(always)] - fn bits() -> uint { ::sys::size_of::<int>() * 8 } - #[inline(always)] fn bytes() -> uint { Primitive::bits::<int>() / 8 } } @@ -69,41 +63,6 @@ mod inst { fn trailing_zeros(&self) -> int { (*self as i32).trailing_zeros() as int } } - // fallback if we don't have access to the current word size - #[cfg(not(target_word_size = "32"), - not(target_word_size = "64"))] - impl BitCount for int { - /// Counts the number of bits set. - #[inline(always)] - fn population_count(&self) -> int { - match ::sys::size_of::<int>() { - 8 => (*self as i64).population_count() as int, - 4 => (*self as i32).population_count() as int, - s => fail!(fmt!("unsupported word size: %?", s)), - } - } - - /// Counts the number of leading zeros. - #[inline(always)] - fn leading_zeros(&self) -> int { - match ::sys::size_of::<int>() { - 8 => (*self as i64).leading_zeros() as int, - 4 => (*self as i32).leading_zeros() as int, - s => fail!(fmt!("unsupported word size: %?", s)), - } - } - - /// Counts the number of trailing zeros. - #[inline(always)] - fn trailing_zeros(&self) -> int { - match ::sys::size_of::<int>() { - 8 => (*self as i64).trailing_zeros() as int, - 4 => (*self as i32).trailing_zeros() as int, - s => fail!(fmt!("unsupported word size: %?", s)), - } - } - } - /// Returns `base` raised to the power of `exponent` pub fn pow(base: int, exponent: uint) -> int { if exponent == 0u { diff --git a/src/libcore/num/uint-template/uint.rs b/src/libcore/num/uint-template/uint.rs index 9e10ed63968..d333b0b58e1 100644 --- a/src/libcore/num/uint-template/uint.rs +++ b/src/libcore/num/uint-template/uint.rs @@ -41,12 +41,6 @@ pub mod inst { #[inline(always)] fn bits() -> uint { 64 } - // fallback if we don't have access to the current word size - #[cfg(not(target_word_size = "32"), - not(target_word_size = "64"))] - #[inline(always)] - fn bits() -> uint { sys::size_of::<uint>() * 8 } - #[inline(always)] fn bytes() -> uint { Primitive::bits::<uint>() / 8 } } @@ -83,41 +77,6 @@ pub mod inst { fn trailing_zeros(&self) -> uint { (*self as i32).trailing_zeros() as uint } } - // fallback if we don't have access to the current word size - #[cfg(not(target_word_size = "32"), - not(target_word_size = "64"))] - impl BitCount for uint { - /// Counts the number of bits set. - #[inline(always)] - fn population_count(&self) -> uint { - match sys::size_of::<uint>() { - 8 => (*self as i64).population_count() as uint, - 4 => (*self as i32).population_count() as uint, - s => fail!(fmt!("unsupported word size: %?", s)), - } - } - - /// Counts the number of leading zeros. - #[inline(always)] - fn leading_zeros(&self) -> uint { - match sys::size_of::<uint>() { - 8 => (*self as i64).leading_zeros() as uint, - 4 => (*self as i32).leading_zeros() as uint, - s => fail!(fmt!("unsupported word size: %?", s)), - } - } - - /// Counts the number of trailing zeros. - #[inline(always)] - fn trailing_zeros(&self) -> uint { - match sys::size_of::<uint>() { - 8 => (*self as i64).trailing_zeros() as uint, - 4 => (*self as i32).trailing_zeros() as uint, - s => fail!(fmt!("unsupported word size: %?", s)), - } - } - } - /// /// Divide two numbers, return the result, rounded up. /// |
