summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2016-11-06 13:26:39 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2016-11-06 13:26:39 +0000
commitf15a8e6a50035efed1a69f872b47925361a44e66 (patch)
tree0cdf83019d9c173a48dc37ac4a4b78a2ffcc1294 /llvm/lib/Bitcode
parent828787a0593b2410faf8b3fb53e80745e3d36c02 (diff)
downloadbcm5719-llvm-f15a8e6a50035efed1a69f872b47925361a44e66.tar.gz
bcm5719-llvm-f15a8e6a50035efed1a69f872b47925361a44e66.zip
[BitcodeWriter] Replace a manual byteswap with read32be.
No functional change intended. llvm-svn: 286066
Diffstat (limited to 'llvm/lib/Bitcode')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 997dcdb9b0b..8de61bc0b7c 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -3630,15 +3630,10 @@ void ModuleBitcodeWriter::writeModuleHash(size_t BlockStartPos) {
SHA1 Hasher;
Hasher.update(ArrayRef<uint8_t>((const uint8_t *)&(Buffer)[BlockStartPos],
Buffer.size() - BlockStartPos));
- auto Hash = Hasher.result();
- SmallVector<uint64_t, 20> Vals;
- auto LShift = [&](unsigned char Val, unsigned Amount)
- -> uint64_t { return ((uint64_t)Val) << Amount; };
+ StringRef Hash = Hasher.result();
+ uint32_t Vals[5];
for (int Pos = 0; Pos < 20; Pos += 4) {
- uint32_t SubHash = LShift(Hash[Pos + 0], 24);
- SubHash |= LShift(Hash[Pos + 1], 16) | LShift(Hash[Pos + 2], 8) |
- (unsigned)(unsigned char)Hash[Pos + 3];
- Vals.push_back(SubHash);
+ Vals[Pos / 4] = support::endian::read32be(Hash.data() + Pos);
}
// Emit the finished record.
OpenPOWER on IntegriCloud