Skip to content

Commit

Permalink
fixup! libstd: Always inline all byteswap functions
Browse files Browse the repository at this point in the history
  • Loading branch information
c-a committed Jan 2, 2014
1 parent 1749d61 commit a82f32b
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions src/libstd/unstable/intrinsics.rs
Expand Up @@ -486,33 +486,33 @@ extern "rust-intrinsic" {
pub fn u64_mul_with_overflow(x: u64, y: u64) -> (u64, bool);
}

#[cfg(target_endian = "little")] #[inline(always)] pub fn to_le16(x: i16) -> i16 { x }
#[cfg(target_endian = "big")] #[inline(always)] pub fn to_le16(x: i16) -> i16 { unsafe { bswap16(x) } }
#[cfg(target_endian = "little")] #[inline(always)] pub fn to_le32(x: i32) -> i32 { x }
#[cfg(target_endian = "big")] #[inline(always)] pub fn to_le32(x: i32) -> i32 { unsafe { bswap32(x) } }
#[cfg(target_endian = "little")] #[inline(always)] pub fn to_le64(x: i64) -> i64 { x }
#[cfg(target_endian = "big")] #[inline(always)] pub fn to_le64(x: i64) -> i64 { unsafe { bswap64(x) } }

#[cfg(target_endian = "little")] #[inline(always)] pub fn to_be16(x: i16) -> i16 { unsafe { bswap16(x) } }
#[cfg(target_endian = "big")] #[inline(always)] pub fn to_be16(x: i16) -> i16 { x }
#[cfg(target_endian = "little")] #[inline(always)] pub fn to_be32(x: i32) -> i32 { unsafe { bswap32(x) } }
#[cfg(target_endian = "big")] #[inline(always)] pub fn to_be32(x: i32) -> i32 { x }
#[cfg(target_endian = "little")] #[inline(always)] pub fn to_be64(x: i64) -> i64 { unsafe { bswap64(x) } }
#[cfg(target_endian = "big")] #[inline(always)] pub fn to_be64(x: i64) -> i64 { x }

#[cfg(target_endian = "little")] #[inline(always)] pub fn from_le16(x: i16) -> i16 { x }
#[cfg(target_endian = "big")] #[inline(always)] pub fn from_le16(x: i16) -> i16 { unsafe { bswap16(x) } }
#[cfg(target_endian = "little")] #[inline(always)] pub fn from_le32(x: i32) -> i32 { x }
#[cfg(target_endian = "big")] #[inline(always)] pub fn from_le32(x: i32) -> i32 { unsafe { bswap32(x) } }
#[cfg(target_endian = "little")] #[inline(always)] pub fn from_le64(x: i64) -> i64 { x }
#[cfg(target_endian = "big")] #[inline(always)] pub fn from_le64(x: i64) -> i64 { unsafe { bswap64(x) } }

#[cfg(target_endian = "little")] #[inline(always)] pub fn from_be16(x: i16) -> i16 { unsafe { bswap16(x) } }
#[cfg(target_endian = "big")] #[inline(always)] pub fn from_be16(x: i16) -> i16 { x }
#[cfg(target_endian = "little")] #[inline(always)] pub fn from_be32(x: i32) -> i32 { unsafe { bswap32(x) } }
#[cfg(target_endian = "big")] #[inline(always)] pub fn from_be32(x: i32) -> i32 { x }
#[cfg(target_endian = "little")] #[inline(always)] pub fn from_be64(x: i64) -> i64 { unsafe { bswap64(x) } }
#[cfg(target_endian = "big")] #[inline(always)] pub fn from_be64(x: i64) -> i64 { x }
#[cfg(target_endian = "little")] #[inline] pub fn to_le16(x: i16) -> i16 { x }
#[cfg(target_endian = "big")] #[inline] pub fn to_le16(x: i16) -> i16 { unsafe { bswap16(x) } }
#[cfg(target_endian = "little")] #[inline] pub fn to_le32(x: i32) -> i32 { x }
#[cfg(target_endian = "big")] #[inline] pub fn to_le32(x: i32) -> i32 { unsafe { bswap32(x) } }
#[cfg(target_endian = "little")] #[inline] pub fn to_le64(x: i64) -> i64 { x }
#[cfg(target_endian = "big")] #[inline] pub fn to_le64(x: i64) -> i64 { unsafe { bswap64(x) } }

#[cfg(target_endian = "little")] #[inline] pub fn to_be16(x: i16) -> i16 { unsafe { bswap16(x) } }
#[cfg(target_endian = "big")] #[inline] pub fn to_be16(x: i16) -> i16 { x }
#[cfg(target_endian = "little")] #[inline] pub fn to_be32(x: i32) -> i32 { unsafe { bswap32(x) } }
#[cfg(target_endian = "big")] #[inline] pub fn to_be32(x: i32) -> i32 { x }
#[cfg(target_endian = "little")] #[inline] pub fn to_be64(x: i64) -> i64 { unsafe { bswap64(x) } }
#[cfg(target_endian = "big")] #[inline] pub fn to_be64(x: i64) -> i64 { x }

#[cfg(target_endian = "little")] #[inline] pub fn from_le16(x: i16) -> i16 { x }
#[cfg(target_endian = "big")] #[inline] pub fn from_le16(x: i16) -> i16 { unsafe { bswap16(x) } }
#[cfg(target_endian = "little")] #[inline] pub fn from_le32(x: i32) -> i32 { x }
#[cfg(target_endian = "big")] #[inline] pub fn from_le32(x: i32) -> i32 { unsafe { bswap32(x) } }
#[cfg(target_endian = "little")] #[inline] pub fn from_le64(x: i64) -> i64 { x }
#[cfg(target_endian = "big")] #[inline] pub fn from_le64(x: i64) -> i64 { unsafe { bswap64(x) } }

#[cfg(target_endian = "little")] #[inline] pub fn from_be16(x: i16) -> i16 { unsafe { bswap16(x) } }
#[cfg(target_endian = "big")] #[inline] pub fn from_be16(x: i16) -> i16 { x }
#[cfg(target_endian = "little")] #[inline] pub fn from_be32(x: i32) -> i32 { unsafe { bswap32(x) } }
#[cfg(target_endian = "big")] #[inline] pub fn from_be32(x: i32) -> i32 { x }
#[cfg(target_endian = "little")] #[inline] pub fn from_be64(x: i64) -> i64 { unsafe { bswap64(x) } }
#[cfg(target_endian = "big")] #[inline] pub fn from_be64(x: i64) -> i64 { x }

/// `TypeId` represents a globally unique identifier for a type
#[lang="type_id"] // This needs to be kept in lockstep with the code in trans/intrinsic.rs and
Expand Down

9 comments on commit a82f32b

@bors
Copy link
Contributor

@bors bors commented on a82f32b Jan 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from brson
at c-a@a82f32b

@bors
Copy link
Contributor

@bors bors commented on a82f32b Jan 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging c-a/rust/inline_byteswap = a82f32b into auto

@bors
Copy link
Contributor

@bors bors commented on a82f32b Jan 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c-a/rust/inline_byteswap = a82f32b merged ok, testing candidate = 7fe0c784

@bors
Copy link
Contributor

@bors bors commented on a82f32b Jan 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on a82f32b Jan 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from brson
at c-a@a82f32b

@bors
Copy link
Contributor

@bors bors commented on a82f32b Jan 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging c-a/rust/inline_byteswap = a82f32b into auto

@bors
Copy link
Contributor

@bors bors commented on a82f32b Jan 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c-a/rust/inline_byteswap = a82f32b merged ok, testing candidate = 0ff6c12

@bors
Copy link
Contributor

@bors bors commented on a82f32b Jan 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on a82f32b Jan 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 0ff6c12

Please sign in to comment.