Skip to content

Fix another endianness issue in i128 trans - #39332

Merged
bors merged 1 commit into
rust-lang:masterfrom
nagisa:another-bigendian-128
Jan 28, 2017
Merged

Fix another endianness issue in i128 trans#39332
bors merged 1 commit into
rust-lang:masterfrom
nagisa:another-bigendian-128

Conversation

@nagisa

Copy link
Copy Markdown
Member

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

Apparently LLVMArbitraryPrecisionInteger demands integers to be in low-endian 64-bytes, rather than
host-endian 64-bytes. This is weird, and obviously, not documented. Also, fixed now. And rustc now
works a teeny bit more on big endians.
@nagisa

Copy link
Copy Markdown
MemberAuthor

Interestingly this is something that wouldn’t be eventually caught by CI if it wasn’t fully built on a big-endian machine.

@nagisa

Copy link
Copy Markdown
MemberAuthor

Probably fixes #39331.

@nagisanagisa changed the title Fix another endian-ness issue in i128 transFix another endianness issue in i128 transJan 27, 2017
@eddyb

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Jan 27, 2017

Copy link
Copy Markdown
Collaborator

📌 Commit b8036b6 has been approved by eddyb

@cuviper

Copy link
Copy Markdown
Member

Apparently LLVMArbitraryPrecisionInteger demands integers to be in low-endian 64-bytes, rather than host-endian 64-bytes. This is weird, and obviously, not documented.

FWIW, I looked into LLVMConstIntOfArbitraryPrecision, which constructs an APInt. That just copies the given words as-is in APInt::initFromArray. Then in usage, bits are indexed by simple division in APInt::whichWord, which makes it little-endian in effect.

staticunsignedwhichWord(unsigned bitPosition) {
return bitPosition / APINT_BITS_PER_WORD;
}

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Jan 28, 2017
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
bors added a commit that referenced this pull request Jan 28, 2017
@bors
bors merged commit b8036b6 into rust-lang:masterJan 28, 2017
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@nagisa@eddyb@bors@cuviper