Skip to content

Fix another endianness issue in i128 trans #39332

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jan 28, 2017

Conversation

nagisa
Copy link
Member

@nagisa nagisa commented Jan 27, 2017

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
Member Author

nagisa commented Jan 27, 2017

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
Member Author

nagisa commented Jan 27, 2017

Probably fixes #39331.

@nagisa nagisa changed the title Fix another endian-ness issue in i128 trans Fix another endianness issue in i128 trans Jan 27, 2017
@eddyb
Copy link
Member

eddyb commented Jan 27, 2017

@bors r+

@bors
Copy link
Collaborator

bors commented Jan 27, 2017

📌 Commit b8036b6 has been approved by eddyb

@cuviper
Copy link
Member

cuviper commented Jan 27, 2017

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.

  static unsigned whichWord(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:master Jan 28, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants