gcc/testsuite/rust/compile/issue-1446.rs
raw| 1 | // fake function |
| 2 | pub fn swap_bytes(this: u32) -> u32 { |
| 3 | (((this) & 0xff000000) >> 24) |
| 4 | | (((this) & 0x00ff0000) >> 8) |
| 5 | | (((this) & 0x0000ff00) << 8) |
| 6 | | (((this) & 0x000000ff) << 24) |
| 7 | } |
| 8 | |
| 9 | pub fn to_le(this: u32) -> u32 { |
| 10 | #[cfg(target_endian = "little")] |
| 11 | { |
| 12 | this |
| 13 | } |
| 14 | #[cfg(not(target_endian = "little"))] |
| 15 | { |
| 16 | swap_bytes(this) |
| 17 | } |
| 18 | } |