From b0b527b62cdcbe6e1a5947534fd749b310856a17 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 7 Feb 2012 10:53:19 +0000 Subject: 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 --- include/llvm/Bitcode/BitstreamReader.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'include/llvm/Bitcode') 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 #include @@ -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(&word), + sizeof(buf), + buf, NULL); - return word; + return *reinterpret_cast(buf); } bool AtEndOfStream() { -- cgit v1.1