Bitcode/BitstreamReader.h: Tweak for big endian hosts.

llvm-svn: 149980
This commit is contained in:
NAKAMURA Takumi 2012-02-07 10:53:19 +00:00
parent e31e606ff3
commit 59580dbf52
1 changed files with 6 additions and 4 deletions

View File

@ -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() {