about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-03-16 22:31:55 -0700
committerbors <bors@rust-lang.org>2014-03-16 22:31:55 -0700
commiteb68beec4b809c1e091ce678a2c18347701497c2 (patch)
treed1007ade36a6e7f563ecab18accd00422b31eb06 /src/libstd
parent6fa72dfe48c8db04562f4d3ab640cb90804af69b (diff)
parent5026d114a0bbe27f2052af9fbadebacac80e1955 (diff)
downloadrust-eb68beec4b809c1e091ce678a2c18347701497c2.tar.gz
rust-eb68beec4b809c1e091ce678a2c18347701497c2.zip
auto merge of #12944 : mcpherrinm/rust/master, r=alexcrichton
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/mem.rs95
1 files changed, 95 insertions, 0 deletions
diff --git a/src/libstd/mem.rs b/src/libstd/mem.rs
index 603f2b80eea..e124ada08c7 100644
--- a/src/libstd/mem.rs
+++ b/src/libstd/mem.rs
@@ -99,32 +99,127 @@ pub unsafe fn move_val_init<T>(dst: &mut T, src: T) {
     intrinsics::move_val_init(dst, src)
 }
 
+/// Convert an i16 to little endian from the target's endianness.
+///
+/// On little endian, this is a no-op.  On big endian, the bytes are swapped.
 #[cfg(target_endian = "little")] #[inline] pub fn to_le16(x: i16) -> i16 { x }
+
+/// Convert an i16 to little endian from the target's endianness.
+///
+/// On little endian, this is a no-op.  On big endian, the bytes are swapped.
 #[cfg(target_endian = "big")]    #[inline] pub fn to_le16(x: i16) -> i16 { unsafe { bswap16(x) } }
+
+/// Convert an i32 to little endian from the target's endianness.
+///
+/// On little endian, this is a no-op.  On big endian, the bytes are swapped.
 #[cfg(target_endian = "little")] #[inline] pub fn to_le32(x: i32) -> i32 { x }
+
+/// Convert an i32 to little endian from the target's endianness.
+///
+/// On little endian, this is a no-op.  On big endian, the bytes are swapped.
 #[cfg(target_endian = "big")]    #[inline] pub fn to_le32(x: i32) -> i32 { unsafe { bswap32(x) } }
+
+/// Convert an i64 to little endian from the target's endianness.
+///
+/// On little endian, this is a no-op.  On big endian, the bytes are swapped.
 #[cfg(target_endian = "little")] #[inline] pub fn to_le64(x: i64) -> i64 { x }
+
+/// Convert an i64 to little endian from the target's endianness.
+///
+/// On little endian, this is a no-op.  On big endian, the bytes are swapped.
 #[cfg(target_endian = "big")]    #[inline] pub fn to_le64(x: i64) -> i64 { unsafe { bswap64(x) } }
 
+
+/// Convert an i16 to big endian from the target's endianness.
+///
+/// On big endian, this is a no-op.  On little endian, the bytes are swapped.
 #[cfg(target_endian = "little")] #[inline] pub fn to_be16(x: i16) -> i16 { unsafe { bswap16(x) } }
+
+/// Convert an i16 to big endian from the target's endianness.
+///
+/// On big endian, this is a no-op.  On little endian, the bytes are swapped.
 #[cfg(target_endian = "big")]    #[inline] pub fn to_be16(x: i16) -> i16 { x }
+
+/// Convert an i32 to big endian from the target's endianness.
+///
+/// On big endian, this is a no-op.  On little endian, the bytes are swapped.
 #[cfg(target_endian = "little")] #[inline] pub fn to_be32(x: i32) -> i32 { unsafe { bswap32(x) } }
+
+/// Convert an i32 to big endian from the target's endianness.
+///
+/// On big endian, this is a no-op.  On little endian, the bytes are swapped.
 #[cfg(target_endian = "big")]    #[inline] pub fn to_be32(x: i32) -> i32 { x }
+
+/// Convert an i64 to big endian from the target's endianness.
+///
+/// On big endian, this is a no-op.  On little endian, the bytes are swapped.
 #[cfg(target_endian = "little")] #[inline] pub fn to_be64(x: i64) -> i64 { unsafe { bswap64(x) } }
+
+/// Convert an i64 to big endian from the target's endianness.
+///
+/// On big endian, this is a no-op.  On little endian, the bytes are swapped.
 #[cfg(target_endian = "big")]    #[inline] pub fn to_be64(x: i64) -> i64 { x }
 
+
+/// Convert an i16 from little endian to the target's endianness.
+///
+/// On little endian, this is a no-op.  On big endian, the bytes are swapped.
 #[cfg(target_endian = "little")] #[inline] pub fn from_le16(x: i16) -> i16 { x }
+
+/// Convert an i16 from little endian to the target's endianness.
+///
+/// On little endian, this is a no-op.  On big endian, the bytes are swapped.
 #[cfg(target_endian = "big")]    #[inline] pub fn from_le16(x: i16) -> i16 { unsafe { bswap16(x) } }
+
+/// Convert an i32 from little endian to the target's endianness.
+///
+/// On little endian, this is a no-op.  On big endian, the bytes are swapped.
 #[cfg(target_endian = "little")] #[inline] pub fn from_le32(x: i32) -> i32 { x }
+
+/// Convert an i32 from little endian to the target's endianness.
+///
+/// On little endian, this is a no-op.  On big endian, the bytes are swapped.
 #[cfg(target_endian = "big")]    #[inline] pub fn from_le32(x: i32) -> i32 { unsafe { bswap32(x) } }
+
+/// Convert an i64 from little endian to the target's endianness.
+///
+/// On little endian, this is a no-op.  On big endian, the bytes are swapped.
 #[cfg(target_endian = "little")] #[inline] pub fn from_le64(x: i64) -> i64 { x }
+
+/// Convert an i64 from little endian to the target's endianness.
+///
+/// On little endian, this is a no-op.  On big endian, the bytes are swapped.
 #[cfg(target_endian = "big")]    #[inline] pub fn from_le64(x: i64) -> i64 { unsafe { bswap64(x) } }
 
+
+/// Convert an i16 from big endian to the target's endianness.
+///
+/// On big endian, this is a no-op.  On little endian, the bytes are swapped.
 #[cfg(target_endian = "little")] #[inline] pub fn from_be16(x: i16) -> i16 { unsafe { bswap16(x) } }
+
+/// Convert an i16 from big endian to the target's endianness.
+///
+/// On big endian, this is a no-op.  On little endian, the bytes are swapped.
 #[cfg(target_endian = "big")]    #[inline] pub fn from_be16(x: i16) -> i16 { x }
+
+/// Convert an i32 from big endian to the target's endianness.
+///
+/// On big endian, this is a no-op.  On little endian, the bytes are swapped.
 #[cfg(target_endian = "little")] #[inline] pub fn from_be32(x: i32) -> i32 { unsafe { bswap32(x) } }
+
+/// Convert an i32 from big endian to the target's endianness.
+///
+/// On big endian, this is a no-op.  On little endian, the bytes are swapped.
 #[cfg(target_endian = "big")]    #[inline] pub fn from_be32(x: i32) -> i32 { x }
+
+/// Convert an i64 from big endian to the target's endianness.
+///
+/// On big endian, this is a no-op.  On little endian, the bytes are swapped.
 #[cfg(target_endian = "little")] #[inline] pub fn from_be64(x: i64) -> i64 { unsafe { bswap64(x) } }
+
+/// Convert an i64 from big endian to the target's endianness.
+///
+/// On big endian, this is a no-op.  On little endian, the bytes are swapped.
 #[cfg(target_endian = "big")]    #[inline] pub fn from_be64(x: i64) -> i64 { x }