mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-25 21:18:19 +00:00
Using llvm::sys::swapByteOrder() for the common case of byte-swapping a value in place
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210978 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user