about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/mem.rs48
-rw-r--r--src/libcore/num/int_macros.rs32
-rw-r--r--src/libcore/num/mod.rs24
-rw-r--r--src/libcore/num/uint_macros.rs32
4 files changed, 68 insertions, 68 deletions
diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs
index 1032b820b27..5280ac0d64f 100644
--- a/src/libcore/mem.rs
+++ b/src/libcore/mem.rs
@@ -173,85 +173,85 @@ pub unsafe fn move_val_init<T>(dst: &mut T, src: T) {
 ///
 /// On little endian, this is a no-op.  On big endian, the bytes are swapped.
 #[inline]
-#[deprecated = "use `Int::to_little_endian` instead"]
-pub fn to_le16(x: u16) -> u16 { x.to_little_endian() }
+#[deprecated = "use `Int::to_le` instead"]
+pub fn to_le16(x: u16) -> u16 { x.to_le() }
 
 /// Convert an u32 to little endian from the target's endianness.
 ///
 /// On little endian, this is a no-op.  On big endian, the bytes are swapped.
 #[inline]
-#[deprecated = "use `Int::to_little_endian` instead"]
-pub fn to_le32(x: u32) -> u32 { x.to_little_endian() }
+#[deprecated = "use `Int::to_le` instead"]
+pub fn to_le32(x: u32) -> u32 { x.to_le() }
 
 /// Convert an u64 to little endian from the target's endianness.
 ///
 /// On little endian, this is a no-op.  On big endian, the bytes are swapped.
 #[inline]
-#[deprecated = "use `Int::to_little_endian` instead"]
-pub fn to_le64(x: u64) -> u64 { x.to_little_endian() }
+#[deprecated = "use `Int::to_le` instead"]
+pub fn to_le64(x: u64) -> u64 { x.to_le() }
 
 /// Convert an u16 to big endian from the target's endianness.
 ///
 /// On big endian, this is a no-op.  On little endian, the bytes are swapped.
 #[inline]
-#[deprecated = "use `Int::to_big_endian` instead"]
-pub fn to_be16(x: u16) -> u16 { x.to_big_endian() }
+#[deprecated = "use `Int::to_be` instead"]
+pub fn to_be16(x: u16) -> u16 { x.to_be() }
 
 /// Convert an u32 to big endian from the target's endianness.
 ///
 /// On big endian, this is a no-op.  On little endian, the bytes are swapped.
 #[inline]
-#[deprecated = "use `Int::to_big_endian` instead"]
-pub fn to_be32(x: u32) -> u32 { x.to_big_endian() }
+#[deprecated = "use `Int::to_be` instead"]
+pub fn to_be32(x: u32) -> u32 { x.to_be() }
 
 /// Convert an u64 to big endian from the target's endianness.
 ///
 /// On big endian, this is a no-op.  On little endian, the bytes are swapped.
 #[inline]
-#[deprecated = "use `Int::to_big_endian` instead"]
-pub fn to_be64(x: u64) -> u64 { x.to_big_endian() }
+#[deprecated = "use `Int::to_be` instead"]
+pub fn to_be64(x: u64) -> u64 { x.to_be() }
 
 /// Convert an u16 from little endian to the target's endianness.
 ///
 /// On little endian, this is a no-op.  On big endian, the bytes are swapped.
 #[inline]
-#[deprecated = "use `Int::from_little_endian` instead"]
-pub fn from_le16(x: u16) -> u16 { Int::from_little_endian(x) }
+#[deprecated = "use `Int::from_le` instead"]
+pub fn from_le16(x: u16) -> u16 { Int::from_le(x) }
 
 /// Convert an u32 from little endian to the target's endianness.
 ///
 /// On little endian, this is a no-op.  On big endian, the bytes are swapped.
 #[inline]
-#[deprecated = "use `Int::from_little_endian` instead"]
-pub fn from_le32(x: u32) -> u32 { Int::from_little_endian(x) }
+#[deprecated = "use `Int::from_le` instead"]
+pub fn from_le32(x: u32) -> u32 { Int::from_le(x) }
 
 /// Convert an u64 from little endian to the target's endianness.
 ///
 /// On little endian, this is a no-op.  On big endian, the bytes are swapped.
 #[inline]
-#[deprecated = "use `Int::from_little_endian` instead"]
-pub fn from_le64(x: u64) -> u64 { Int::from_little_endian(x) }
+#[deprecated = "use `Int::from_le` instead"]
+pub fn from_le64(x: u64) -> u64 { Int::from_le(x) }
 
 /// Convert an u16 from big endian to the target's endianness.
 ///
 /// On big endian, this is a no-op.  On little endian, the bytes are swapped.
 #[inline]
-#[deprecated = "use `Int::from_big_endian` instead"]
-pub fn from_be16(x: u16) -> u16 { Int::from_big_endian(x) }
+#[deprecated = "use `Int::from_be` instead"]
+pub fn from_be16(x: u16) -> u16 { Int::from_be(x) }
 
 /// Convert an u32 from big endian to the target's endianness.
 ///
 /// On big endian, this is a no-op.  On little endian, the bytes are swapped.
 #[inline]
-#[deprecated = "use `Int::from_big_endian` instead"]
-pub fn from_be32(x: u32) -> u32 { Int::from_big_endian(x) }
+#[deprecated = "use `Int::from_be` instead"]
+pub fn from_be32(x: u32) -> u32 { Int::from_be(x) }
 
 /// Convert an u64 from big endian to the target's endianness.
 ///
 /// On big endian, this is a no-op.  On little endian, the bytes are swapped.
 #[inline]
-#[deprecated = "use `Int::from_big_endian` instead"]
-pub fn from_be64(x: u64) -> u64 { Int::from_big_endian(x) }
+#[deprecated = "use `Int::from_be` instead"]
+pub fn from_be64(x: u64) -> u64 { Int::from_be(x) }
 
 /// Swap the values at two mutable locations of the same type, without
 /// deinitialising or copying either one.
diff --git a/src/libcore/num/int_macros.rs b/src/libcore/num/int_macros.rs
index 84744b3f5d7..79734324706 100644
--- a/src/libcore/num/int_macros.rs
+++ b/src/libcore/num/int_macros.rs
@@ -147,25 +147,25 @@ mod tests {
     }
 
     #[test]
-    fn test_little_endian() {
-        assert_eq!(Int::from_little_endian(A.to_little_endian()), A);
-        assert_eq!(Int::from_little_endian(B.to_little_endian()), B);
-        assert_eq!(Int::from_little_endian(C.to_little_endian()), C);
-        assert_eq!(Int::from_little_endian(_0), _0);
-        assert_eq!(Int::from_little_endian(_1), _1);
-        assert_eq!(_0.to_little_endian(), _0);
-        assert_eq!(_1.to_little_endian(), _1);
+    fn test_le() {
+        assert_eq!(Int::from_le(A.to_le()), A);
+        assert_eq!(Int::from_le(B.to_le()), B);
+        assert_eq!(Int::from_le(C.to_le()), C);
+        assert_eq!(Int::from_le(_0), _0);
+        assert_eq!(Int::from_le(_1), _1);
+        assert_eq!(_0.to_le(), _0);
+        assert_eq!(_1.to_le(), _1);
     }
 
     #[test]
-    fn test_big_endian() {
-        assert_eq!(Int::from_big_endian(A.to_big_endian()), A);
-        assert_eq!(Int::from_big_endian(B.to_big_endian()), B);
-        assert_eq!(Int::from_big_endian(C.to_big_endian()), C);
-        assert_eq!(Int::from_big_endian(_0), _0);
-        assert_eq!(Int::from_big_endian(_1), _1);
-        assert_eq!(_0.to_big_endian(), _0);
-        assert_eq!(_1.to_big_endian(), _1);
+    fn test_be() {
+        assert_eq!(Int::from_be(A.to_be()), A);
+        assert_eq!(Int::from_be(B.to_be()), B);
+        assert_eq!(Int::from_be(C.to_be()), C);
+        assert_eq!(Int::from_be(_0), _0);
+        assert_eq!(Int::from_be(_1), _1);
+        assert_eq!(_0.to_be(), _0);
+        assert_eq!(_1.to_be(), _1);
     }
 
     #[test]
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs
index ed0c24e7fa0..dd32a6da106 100644
--- a/src/libcore/num/mod.rs
+++ b/src/libcore/num/mod.rs
@@ -498,13 +498,13 @@ pub trait Int: Primitive
     /// let n = 0x0123456789ABCDEFu64;
     ///
     /// if cfg!(target_endian = "big") {
-    ///     assert_eq!(Int::from_big_endian(n), n)
+    ///     assert_eq!(Int::from_be(n), n)
     /// } else {
-    ///     assert_eq!(Int::from_big_endian(n), n.swap_bytes())
+    ///     assert_eq!(Int::from_be(n), n.swap_bytes())
     /// }
     /// ```
     #[inline]
-    fn from_big_endian(x: Self) -> Self {
+    fn from_be(x: Self) -> Self {
         if cfg!(target_endian = "big") { x } else { x.swap_bytes() }
     }
 
@@ -518,13 +518,13 @@ pub trait Int: Primitive
     /// let n = 0x0123456789ABCDEFu64;
     ///
     /// if cfg!(target_endian = "little") {
-    ///     assert_eq!(Int::from_little_endian(n), n)
+    ///     assert_eq!(Int::from_le(n), n)
     /// } else {
-    ///     assert_eq!(Int::from_little_endian(n), n.swap_bytes())
+    ///     assert_eq!(Int::from_le(n), n.swap_bytes())
     /// }
     /// ```
     #[inline]
-    fn from_little_endian(x: Self) -> Self {
+    fn from_le(x: Self) -> Self {
         if cfg!(target_endian = "little") { x } else { x.swap_bytes() }
     }
 
@@ -538,13 +538,13 @@ pub trait Int: Primitive
     /// let n = 0x0123456789ABCDEFu64;
     ///
     /// if cfg!(target_endian = "big") {
-    ///     assert_eq!(n.to_big_endian(), n)
+    ///     assert_eq!(n.to_be(), n)
     /// } else {
-    ///     assert_eq!(n.to_big_endian(), n.swap_bytes())
+    ///     assert_eq!(n.to_be(), n.swap_bytes())
     /// }
     /// ```
     #[inline]
-    fn to_big_endian(self) -> Self {
+    fn to_be(self) -> Self { // or not to be?
         if cfg!(target_endian = "big") { self } else { self.swap_bytes() }
     }
 
@@ -558,13 +558,13 @@ pub trait Int: Primitive
     /// let n = 0x0123456789ABCDEFu64;
     ///
     /// if cfg!(target_endian = "little") {
-    ///     assert_eq!(n.to_little_endian(), n)
+    ///     assert_eq!(n.to_le(), n)
     /// } else {
-    ///     assert_eq!(n.to_little_endian(), n.swap_bytes())
+    ///     assert_eq!(n.to_le(), n.swap_bytes())
     /// }
     /// ```
     #[inline]
-    fn to_little_endian(self) -> Self {
+    fn to_le(self) -> Self {
         if cfg!(target_endian = "little") { self } else { self.swap_bytes() }
     }
 }
diff --git a/src/libcore/num/uint_macros.rs b/src/libcore/num/uint_macros.rs
index 1fe3c4cf1f1..be1f960bcc3 100644
--- a/src/libcore/num/uint_macros.rs
+++ b/src/libcore/num/uint_macros.rs
@@ -98,25 +98,25 @@ mod tests {
     }
 
     #[test]
-    fn test_little_endian() {
-        assert_eq!(Int::from_little_endian(A.to_little_endian()), A);
-        assert_eq!(Int::from_little_endian(B.to_little_endian()), B);
-        assert_eq!(Int::from_little_endian(C.to_little_endian()), C);
-        assert_eq!(Int::from_little_endian(_0), _0);
-        assert_eq!(Int::from_little_endian(_1), _1);
-        assert_eq!(_0.to_little_endian(), _0);
-        assert_eq!(_1.to_little_endian(), _1);
+    fn test_le() {
+        assert_eq!(Int::from_le(A.to_le()), A);
+        assert_eq!(Int::from_le(B.to_le()), B);
+        assert_eq!(Int::from_le(C.to_le()), C);
+        assert_eq!(Int::from_le(_0), _0);
+        assert_eq!(Int::from_le(_1), _1);
+        assert_eq!(_0.to_le(), _0);
+        assert_eq!(_1.to_le(), _1);
     }
 
     #[test]
-    fn test_big_endian() {
-        assert_eq!(Int::from_big_endian(A.to_big_endian()), A);
-        assert_eq!(Int::from_big_endian(B.to_big_endian()), B);
-        assert_eq!(Int::from_big_endian(C.to_big_endian()), C);
-        assert_eq!(Int::from_big_endian(_0), _0);
-        assert_eq!(Int::from_big_endian(_1), _1);
-        assert_eq!(_0.to_big_endian(), _0);
-        assert_eq!(_1.to_big_endian(), _1);
+    fn test_be() {
+        assert_eq!(Int::from_be(A.to_be()), A);
+        assert_eq!(Int::from_be(B.to_be()), B);
+        assert_eq!(Int::from_be(C.to_be()), C);
+        assert_eq!(Int::from_be(_0), _0);
+        assert_eq!(Int::from_be(_1), _1);
+        assert_eq!(_0.to_be(), _0);
+        assert_eq!(_1.to_be(), _1);
     }
 
     #[test]