[llvm-bcanalyzer] Simplify code. NFCI.

This commit is contained in:
Benjamin Kramer 2020-04-06 12:50:34 +02:00
parent 9fa38c985f
commit 9a9bc23672
1 changed files with 4 additions and 7 deletions

View File

@ -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!)";