-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
testsuite: Fix missing handling of little endian.
Some failures occur in the testsuite because we did not account for the little-endian case. gcc/testsuite/ChangeLog: * rust/compile/issue-1446.rs: Add swap_bytes function. * rust/compile/iterators1.rs: Remove unused {to, from}_le functions.
- Loading branch information
1 parent
b4a525c
commit 828b935
Showing
2 changed files
with
9 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
// fake function | ||
pub fn swap_bytes(this: u32) -> u32 { | ||
(((this) & 0xff000000) >> 24) | ||
| (((this) & 0x00ff0000) >> 8) | ||
| (((this) & 0x0000ff00) << 8) | ||
| (((this) & 0x000000ff) << 24) | ||
} | ||
|
||
pub fn to_le(this: u32) -> u32 { | ||
#[cfg(target_endian = "little")] | ||
{ | ||
this | ||
} | ||
#[cfg(not(target_endian = "little"))] | ||
{ | ||
this.swap_bytes() | ||
swap_bytes(this) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters