Skip to content

Commit 30ae115

Browse files
committed
Rollup merge of rust-lang#39332 - nagisa:another-bigendian-128, r=eddyb
Fix another endianness issue in i128 trans Apparently LLVMArbitraryPrecisionInteger demands integers to be in low-endian 64-bytes, rather than host-endian 64-bytes. This is weird, and obviously, not documented. And rustc now works a teeny bit more on big endians. r? @eddyb
2 parents a5ff116 + b8036b6 commit 30ae115

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/librustc_trans/common.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ pub fn C_integral(t: Type, u: u64, sign_extend: bool) -> ValueRef {
234234
pub fn C_big_integral(t: Type, u: u128, sign_extend: bool) -> ValueRef {
235235
if ::std::mem::size_of::<u128>() == 16 {
236236
unsafe {
237-
llvm::LLVMConstIntOfArbitraryPrecision(t.to_ref(), 2, &u as *const u128 as *const u64)
237+
let words = [u as u64, u.wrapping_shr(64) as u64];
238+
llvm::LLVMConstIntOfArbitraryPrecision(t.to_ref(), 2, words.as_ptr())
238239
}
239240
} else {
240241
// SNAP: remove after snapshot

0 commit comments

Comments
 (0)