未验证 提交 b3d60503 编写于 作者: P Pietro Albini 提交者: GitHub

Rollup merge of #52876 - cuviper:const-endianness-be, r=kennytm

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.
......@@ -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());
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册