Skip to content

Commit

Permalink
Rollup merge of rust-lang#52876 - cuviper:const-endianness-be, r=kennytm
Browse files Browse the repository at this point in the history
run-pass/const-endianness: negate before to_le()

`const LE_I128` needs parentheses to negate the value *before* calling
`to_le()`, otherwise it doesn't match the operations performed in the
black-boxed part of the test.  This only makes a tangible difference on
big-endian targets.
  • Loading branch information
GuillaumeGomez authored Jul 31, 2018
2 parents 50e7fdd + 1ea2765 commit 378c638
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/test/run-pass/const-endianess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn main() {
#[cfg(not(target_arch = "asmjs"))]
{
const BE_U128: u128 = 999999u128.to_be();
const LE_I128: i128 = -999999i128.to_le();
const LE_I128: i128 = (-999999i128).to_le();
assert_eq!(BE_U128, b(999999u128).to_be());
assert_eq!(LE_I128, b(-999999i128).to_le());
}
Expand Down

0 comments on commit 378c638

Please sign in to comment.