diff options
author | Artyom Skrobov <Artyom.Skrobov@arm.com> | 2014-06-14 13:18:07 +0000 |
---|---|---|
committer | Artyom Skrobov <Artyom.Skrobov@arm.com> | 2014-06-14 13:18:07 +0000 |
commit | 9aea8432c56611ab377d3451a09e49baf0f6a64d (patch) | |
tree | c541f9add994d577c8e2f07caa97a6ab441837c6 /llvm/lib | |
parent | 4156ac2ecd803a54465ef796e9c45a56143b75c6 (diff) | |
download | bcm5719-llvm-9aea8432c56611ab377d3451a09e49baf0f6a64d.tar.gz bcm5719-llvm-9aea8432c56611ab377d3451a09e49baf0f6a64d.zip |
Using llvm::sys::swapByteOrder() for the common case of byte-swapping a value in place
llvm-svn: 210978
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h | 6 | ||||
-rw-r--r-- | llvm/lib/MC/ELFObjectWriter.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Support/DataExtractor.cpp | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h index 3e9a68a2a30..11cc3b246ac 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h @@ -245,14 +245,14 @@ protected: void writeInt16BE(uint8_t *Addr, uint16_t Value) { if (IsTargetLittleEndian) - Value = sys::getSwappedBytes(Value); + sys::swapByteOrder(Value); *Addr = (Value >> 8) & 0xFF; *(Addr + 1) = Value & 0xFF; } void writeInt32BE(uint8_t *Addr, uint32_t Value) { if (IsTargetLittleEndian) - Value = sys::getSwappedBytes(Value); + sys::swapByteOrder(Value); *Addr = (Value >> 24) & 0xFF; *(Addr + 1) = (Value >> 16) & 0xFF; *(Addr + 2) = (Value >> 8) & 0xFF; @@ -261,7 +261,7 @@ protected: void writeInt64BE(uint8_t *Addr, uint64_t Value) { if (IsTargetLittleEndian) - Value = sys::getSwappedBytes(Value); + sys::swapByteOrder(Value); *Addr = (Value >> 56) & 0xFF; *(Addr + 1) = (Value >> 48) & 0xFF; *(Addr + 2) = (Value >> 40) & 0xFF; diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp index 0a17c33f7fb..a98a13e0cd4 100644 --- a/llvm/lib/MC/ELFObjectWriter.cpp +++ b/llvm/lib/MC/ELFObjectWriter.cpp @@ -1179,7 +1179,7 @@ prependCompressionHeader(uint64_t Size, if (Size <= Magic.size() + sizeof(Size) + CompressedContents.size()) return false; if (sys::IsLittleEndianHost) - Size = sys::getSwappedBytes(Size); + sys::swapByteOrder(Size); CompressedContents.insert(CompressedContents.begin(), Magic.size() + sizeof(Size), 0); std::copy(Magic.begin(), Magic.end(), CompressedContents.begin()); diff --git a/llvm/lib/Support/DataExtractor.cpp b/llvm/lib/Support/DataExtractor.cpp index c320554b636..5d6d60a87fb 100644 --- a/llvm/lib/Support/DataExtractor.cpp +++ b/llvm/lib/Support/DataExtractor.cpp @@ -21,7 +21,7 @@ static T getU(uint32_t *offset_ptr, const DataExtractor *de, if (de->isValidOffsetForDataOfSize(offset, sizeof(val))) { std::memcpy(&val, &Data[offset], sizeof(val)); if (sys::IsLittleEndianHost != isLittleEndian) - val = sys::getSwappedBytes(val); + sys::swapByteOrder(val); // Advance the offset *offset_ptr += sizeof(val); |