diff options
Diffstat (limited to 'src/libcore/num/mod.rs')
| -rw-r--r-- | src/libcore/num/mod.rs | 192 |
1 files changed, 0 insertions, 192 deletions
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 7e2dd304d7f..e0d267a6ce0 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -267,21 +267,12 @@ $EndFeature, " ``` "), #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(not(stage0))] #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn count_ones(self) -> u32 { (self as $UnsignedT).count_ones() } } doc_comment! { - concat!("Dummy docs. See !stage0 documentation"), - #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(stage0)] - #[inline] - pub fn count_ones(self) -> u32 { (self as $UnsignedT).count_ones() } - } - - doc_comment! { concat!("Returns the number of zeros in the binary representation of `self`. # Examples @@ -292,7 +283,6 @@ Basic usage: ", $Feature, "assert_eq!(", stringify!($SelfT), "::max_value().count_zeros(), 1);", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(not(stage0))] #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn count_zeros(self) -> u32 { @@ -301,16 +291,6 @@ Basic usage: } doc_comment! { - concat!("Dummy docs. See !stage0 documentatio"), - #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(stage0)] - #[inline] - pub fn count_zeros(self) -> u32 { - (!self).count_ones() - } - } - - doc_comment! { concat!("Returns the number of leading zeros in the binary representation of `self`. # Examples @@ -324,7 +304,6 @@ assert_eq!(n.leading_zeros(), 0);", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(not(stage0))] #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn leading_zeros(self) -> u32 { @@ -333,16 +312,6 @@ $EndFeature, " } doc_comment! { - concat!("Dummy docs. See !stage0 documentation"), - #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(stage0)] - #[inline] - pub fn leading_zeros(self) -> u32 { - (self as $UnsignedT).leading_zeros() - } - } - - doc_comment! { concat!("Returns the number of trailing zeros in the binary representation of `self`. # Examples @@ -356,7 +325,6 @@ assert_eq!(n.trailing_zeros(), 2);", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(not(stage0))] #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn trailing_zeros(self) -> u32 { @@ -364,16 +332,6 @@ $EndFeature, " } } - doc_comment! { - concat!("Dummy docs. See !stage0 documentation"), - #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(stage0)] - #[inline] - pub fn trailing_zeros(self) -> u32 { - (self as $UnsignedT).trailing_zeros() - } - } - /// Shifts the bits to the left by a specified amount, `n`, /// wrapping the truncated bits to the end of the resulting integer. /// @@ -442,21 +400,12 @@ $EndFeature, " /// assert_eq!(m, 21760); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(not(stage0))] #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn swap_bytes(self) -> Self { (self as $UnsignedT).swap_bytes() as Self } - /// Dummy docs. See !stage0 documentation. - #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(stage0)] - #[inline] - pub fn swap_bytes(self) -> Self { - (self as $UnsignedT).swap_bytes() as Self - } - /// Reverses the bit pattern of the integer. /// /// # Examples @@ -503,7 +452,6 @@ if cfg!(target_endian = \"big\") { $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(not(stage0))] #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn from_be(x: Self) -> Self { @@ -519,16 +467,6 @@ $EndFeature, " } doc_comment! { - concat!("Dummy docs. See !stage0 documentation"), - #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(stage0)] - #[inline] - pub fn from_be(x: Self) -> Self { - if cfg!(target_endian = "big") { x } else { x.swap_bytes() } - } - } - - doc_comment! { concat!("Converts an integer from little endian to the target's endianness. On little endian this is a no-op. On big endian the bytes are swapped. @@ -548,7 +486,6 @@ if cfg!(target_endian = \"little\") { $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(not(stage0))] #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn from_le(x: Self) -> Self { @@ -564,16 +501,6 @@ $EndFeature, " } doc_comment! { - concat!("Dummy docs. See !stage0 documentation"), - #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(stage0)] - #[inline] - pub fn from_le(x: Self) -> Self { - if cfg!(target_endian = "little") { x } else { x.swap_bytes() } - } - } - - doc_comment! { concat!("Converts `self` to big endian from the target's endianness. On big endian this is a no-op. On little endian the bytes are swapped. @@ -593,7 +520,6 @@ if cfg!(target_endian = \"big\") { $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(not(stage0))] #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn to_be(self) -> Self { // or not to be? @@ -609,16 +535,6 @@ $EndFeature, " } doc_comment! { - concat!("Dummy docs. See !stage0 documentation"), - #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(stage0)] - #[inline] - pub fn to_be(self) -> Self { // or not to be? - if cfg!(target_endian = "big") { self } else { self.swap_bytes() } - } - } - - doc_comment! { concat!("Converts `self` to little endian from the target's endianness. On little endian this is a no-op. On big endian the bytes are swapped. @@ -638,7 +554,6 @@ if cfg!(target_endian = \"little\") { $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(not(stage0))] #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn to_le(self) -> Self { @@ -654,16 +569,6 @@ $EndFeature, " } doc_comment! { - concat!("Dummy docs. See !stage0 documentation"), - #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(stage0)] - #[inline] - pub fn to_le(self) -> Self { - if cfg!(target_endian = "little") { self } else { self.swap_bytes() } - } - } - - doc_comment! { concat!("Checked integer addition. Computes `self + rhs`, returning `None` if overflow occurred. @@ -2161,7 +2066,6 @@ Basic usage: assert_eq!(n.count_ones(), 3);", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(not(stage0))] #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn count_ones(self) -> u32 { @@ -2170,16 +2074,6 @@ assert_eq!(n.count_ones(), 3);", $EndFeature, " } doc_comment! { - concat!("Dummy docs. See !stage0 documentation"), - #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(stage0)] - #[inline] - pub fn count_ones(self) -> u32 { - unsafe { intrinsics::ctpop(self as $ActualT) as u32 } - } - } - - doc_comment! { concat!("Returns the number of zeros in the binary representation of `self`. # Examples @@ -2190,7 +2084,6 @@ Basic usage: ", $Feature, "assert_eq!(", stringify!($SelfT), "::max_value().count_zeros(), 0);", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(not(stage0))] #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn count_zeros(self) -> u32 { @@ -2199,16 +2092,6 @@ Basic usage: } doc_comment! { - concat!("Dummy docs. See !stage0 documentation"), - #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(stage0)] - #[inline] - pub fn count_zeros(self) -> u32 { - (!self).count_ones() - } - } - - doc_comment! { concat!("Returns the number of leading zeros in the binary representation of `self`. # Examples @@ -2221,7 +2104,6 @@ Basic usage: assert_eq!(n.leading_zeros(), 2);", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(not(stage0))] #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn leading_zeros(self) -> u32 { @@ -2230,16 +2112,6 @@ assert_eq!(n.leading_zeros(), 2);", $EndFeature, " } doc_comment! { - concat!("Dummy docs. See !stage0 documentation"), - #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(stage0)] - #[inline] - pub fn leading_zeros(self) -> u32 { - unsafe { intrinsics::ctlz(self as $ActualT) as u32 } - } - } - - doc_comment! { concat!("Returns the number of trailing zeros in the binary representation of `self`. @@ -2253,7 +2125,6 @@ Basic usage: assert_eq!(n.trailing_zeros(), 3);", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(not(stage0))] #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn trailing_zeros(self) -> u32 { @@ -2261,16 +2132,6 @@ assert_eq!(n.trailing_zeros(), 3);", $EndFeature, " } } - doc_comment! { - concat!("Dummy docs. See !stage0 documentation"), - #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(stage0)] - #[inline] - pub fn trailing_zeros(self) -> u32 { - unsafe { uint_cttz_call!(self, $BITS) as u32 } - } - } - /// Shifts the bits to the left by a specified amount, `n`, /// wrapping the truncated bits to the end of the resulting integer. /// @@ -2343,21 +2204,12 @@ assert_eq!(n.trailing_zeros(), 3);", $EndFeature, " /// assert_eq!(m, 21760); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(not(stage0))] #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn swap_bytes(self) -> Self { unsafe { intrinsics::bswap(self as $ActualT) as Self } } - /// Dummy docs. See !stage0 documentation. - #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(stage0)] - #[inline] - pub fn swap_bytes(self) -> Self { - unsafe { intrinsics::bswap(self as $ActualT) as Self } - } - /// Reverses the bit pattern of the integer. /// /// # Examples @@ -2404,7 +2256,6 @@ if cfg!(target_endian = \"big\") { }", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(not(stage0))] #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn from_be(x: Self) -> Self { @@ -2420,16 +2271,6 @@ if cfg!(target_endian = \"big\") { } doc_comment! { - concat!("Dummy docs. See !stage0 documentation"), - #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(stage0)] - #[inline] - pub fn from_be(x: Self) -> Self { - if cfg!(target_endian = "big") { x } else { x.swap_bytes() } - } - } - - doc_comment! { concat!("Converts an integer from little endian to the target's endianness. On little endian this is a no-op. On big endian the bytes are @@ -2449,7 +2290,6 @@ if cfg!(target_endian = \"little\") { }", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(not(stage0))] #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn from_le(x: Self) -> Self { @@ -2465,16 +2305,6 @@ if cfg!(target_endian = \"little\") { } doc_comment! { - concat!("Dummy docs. See !stage0 documentation"), - #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(stage0)] - #[inline] - pub fn from_le(x: Self) -> Self { - if cfg!(target_endian = "little") { x } else { x.swap_bytes() } - } - } - - doc_comment! { concat!("Converts `self` to big endian from the target's endianness. On big endian this is a no-op. On little endian the bytes are @@ -2494,7 +2324,6 @@ if cfg!(target_endian = \"big\") { }", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(not(stage0))] #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn to_be(self) -> Self { // or not to be? @@ -2510,16 +2339,6 @@ if cfg!(target_endian = \"big\") { } doc_comment! { - concat!("Dummy docs. See !stage0 documentation"), - #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(stage0)] - #[inline] - pub fn to_be(self) -> Self { // or not to be? - if cfg!(target_endian = "big") { self } else { self.swap_bytes() } - } - } - - doc_comment! { concat!("Converts `self` to little endian from the target's endianness. On little endian this is a no-op. On big endian the bytes are @@ -2539,7 +2358,6 @@ if cfg!(target_endian = \"little\") { }", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(not(stage0))] #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn to_le(self) -> Self { @@ -2555,16 +2373,6 @@ if cfg!(target_endian = \"little\") { } doc_comment! { - concat!("Dummy docs. See !stage0 documentation"), - #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(stage0)] - #[inline] - pub fn to_le(self) -> Self { - if cfg!(target_endian = "little") { self } else { self.swap_bytes() } - } - } - - doc_comment! { concat!("Checked integer addition. Computes `self + rhs`, returning `None` if overflow occurred. |
