diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2012-02-07 10:53:19 +0000 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2012-02-07 10:53:19 +0000 |
commit | b0b527b62cdcbe6e1a5947534fd749b310856a17 (patch) | |
tree | d35fcf5ed18b071344c064ff9c9f78966d522860 /include/llvm/Bitcode | |
parent | e26cdbe1c7f66e201626a61b5eb98ebb330018e0 (diff) | |
download | external_llvm-b0b527b62cdcbe6e1a5947534fd749b310856a17.zip external_llvm-b0b527b62cdcbe6e1a5947534fd749b310856a17.tar.gz external_llvm-b0b527b62cdcbe6e1a5947534fd749b310856a17.tar.bz2 |
Bitcode/BitstreamReader.h: Tweak for big endian hosts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149980 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Bitcode')
-rw-r--r-- | include/llvm/Bitcode/BitstreamReader.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/include/llvm/Bitcode/BitstreamReader.h b/include/llvm/Bitcode/BitstreamReader.h index e55910b..6586829 100644 --- a/include/llvm/Bitcode/BitstreamReader.h +++ b/include/llvm/Bitcode/BitstreamReader.h @@ -17,6 +17,7 @@ #include "llvm/ADT/OwningPtr.h" #include "llvm/Bitcode/BitCodes.h" +#include "llvm/Support/Endian.h" #include "llvm/Support/StreamableMemoryObject.h" #include <climits> #include <string> @@ -242,12 +243,13 @@ public: } uint32_t getWord(size_t pos) { - uint32_t word = -1; + uint8_t buf[sizeof(uint32_t)]; + memset(buf, 0xFF, sizeof(buf)); BitStream->getBitcodeBytes().readBytes(pos, - sizeof(word), - reinterpret_cast<uint8_t *>(&word), + sizeof(buf), + buf, NULL); - return word; + return *reinterpret_cast<support::ulittle32_t *>(buf); } bool AtEndOfStream() { |