[llvm] 232eff5 - [LTO] Replace hand-rolled endian conversion with support::endian. NFCI.
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 6 04:30:41 PDT 2020
Author: Benjamin Kramer
Date: 2020-04-06T13:23:27+02:00
New Revision: 232eff55f654cbe42b18ce96722ddda15dd67957
URL: https://github.com/llvm/llvm-project/commit/232eff55f654cbe42b18ce96722ddda15dd67957
DIFF: https://github.com/llvm/llvm-project/commit/232eff55f654cbe42b18ce96722ddda15dd67957.diff
LOG: [LTO] Replace hand-rolled endian conversion with support::endian. NFCI.
Added:
Modified:
llvm/lib/LTO/LTO.cpp
Removed:
################################################################################
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index f652bd628770..e9eb1d136e75 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -98,22 +98,12 @@ void llvm::computeLTOCacheKey(
};
auto AddUnsigned = [&](unsigned I) {
uint8_t Data[4];
- Data[0] = I;
- Data[1] = I >> 8;
- Data[2] = I >> 16;
- Data[3] = I >> 24;
+ support::endian::write32le(Data, I);
Hasher.update(ArrayRef<uint8_t>{Data, 4});
};
auto AddUint64 = [&](uint64_t I) {
uint8_t Data[8];
- Data[0] = I;
- Data[1] = I >> 8;
- Data[2] = I >> 16;
- Data[3] = I >> 24;
- Data[4] = I >> 32;
- Data[5] = I >> 40;
- Data[6] = I >> 48;
- Data[7] = I >> 56;
+ support::endian::write64le(Data, I);
Hasher.update(ArrayRef<uint8_t>{Data, 8});
};
AddString(Conf.CPU);
More information about the llvm-commits
mailing list