aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp b/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
index e70caa8..69ab822 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
@@ -910,17 +910,14 @@ Error BitcodeAnalyzer::parseBlock(unsigned BlockID, unsigned IndentLevel,
Hasher.update(ArrayRef<uint8_t>(Ptr, BlockSize));
Hash = Hasher.result();
}
- SmallString<20> RecordedHash;
- RecordedHash.resize(20);
+ std::array<char, 20> RecordedHash;
int Pos = 0;
for (auto &Val : Record) {
assert(!(Val >> 32) && "Unexpected high bits set");
- RecordedHash[Pos++] = (Val >> 24) & 0xFF;
- RecordedHash[Pos++] = (Val >> 16) & 0xFF;
- RecordedHash[Pos++] = (Val >> 8) & 0xFF;
- RecordedHash[Pos++] = (Val >> 0) & 0xFF;
+ support::endian::write32be(&RecordedHash[Pos], Val);
+ Pos += 4;
}
- if (Hash == RecordedHash)
+ if (Hash == StringRef(RecordedHash.data(), RecordedHash.size()))
O->OS << " (match)";
else
O->OS << " (!mismatch!)";