mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-22 21:09:52 +00:00
Merge pull request #13490 from hrydgard/byteswap-h-name-fail
ByteSwap.h results in a file name collision on some systems with byteswap.h
This commit is contained in:
commit
fdc05bf53e
@ -444,7 +444,6 @@ add_library(Common STATIC
|
||||
Common/BitSet.h
|
||||
Common/Buffer.h
|
||||
Common/Buffer.cpp
|
||||
Common/ByteSwap.h
|
||||
Common/CodeBlock.h
|
||||
Common/ColorConv.cpp
|
||||
Common/ColorConv.h
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdlib> // for byte swapping
|
||||
#include <cstddef>
|
||||
#include "CommonTypes.h"
|
||||
|
||||
@ -39,3 +41,28 @@ inline int CountSetBits(u64 val) { return __builtin_popcountll(val); }
|
||||
inline int LeastSignificantSetBit(u32 val) { return __builtin_ctz(val); }
|
||||
inline int LeastSignificantSetBit(u64 val) { return __builtin_ctzll(val); }
|
||||
#endif
|
||||
|
||||
// Byteswapping
|
||||
// Just in case this has been defined by platform
|
||||
#undef swap16
|
||||
#undef swap32
|
||||
#undef swap64
|
||||
|
||||
#ifdef _WIN32
|
||||
inline uint16_t swap16(uint16_t _data) { return _byteswap_ushort(_data); }
|
||||
inline uint32_t swap32(uint32_t _data) { return _byteswap_ulong(_data); }
|
||||
inline uint64_t swap64(uint64_t _data) { return _byteswap_uint64(_data); }
|
||||
#elif defined(__GNUC__)
|
||||
inline uint16_t swap16(uint16_t _data) { return __builtin_bswap16(_data); }
|
||||
inline uint32_t swap32(uint32_t _data) { return __builtin_bswap32(_data); }
|
||||
inline uint64_t swap64(uint64_t _data) { return __builtin_bswap64(_data); }
|
||||
#else
|
||||
// Slow generic implementation. Hopefully this never hits
|
||||
inline uint16_t swap16(uint16_t data) { return (data >> 8) | (data << 8); }
|
||||
inline uint32_t swap32(uint32_t data) { return (swap16(data) << 16) | swap16(data >> 16); }
|
||||
inline uint64_t swap64(uint64_t data) { return ((uint64_t)swap32(data) << 32) | swap32(data >> 32); }
|
||||
#endif
|
||||
|
||||
inline uint16_t swap16(const uint8_t* _pData) { return swap16(*(const uint16_t*)_pData); }
|
||||
inline uint32_t swap32(const uint8_t* _pData) { return swap32(*(const uint32_t*)_pData); }
|
||||
inline uint64_t swap64(const uint8_t* _pData) { return swap64(*(const uint64_t*)_pData); }
|
||||
|
@ -1,29 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdlib> // for byte swapping
|
||||
|
||||
// Byteswapping
|
||||
// Just in case this has been defined by platform
|
||||
#undef swap16
|
||||
#undef swap32
|
||||
#undef swap64
|
||||
|
||||
#ifdef _WIN32
|
||||
inline uint16_t swap16(uint16_t _data) { return _byteswap_ushort(_data); }
|
||||
inline uint32_t swap32(uint32_t _data) { return _byteswap_ulong(_data); }
|
||||
inline uint64_t swap64(uint64_t _data) { return _byteswap_uint64(_data); }
|
||||
#elif defined(__GNUC__)
|
||||
inline uint16_t swap16(uint16_t _data) { return __builtin_bswap16(_data); }
|
||||
inline uint32_t swap32(uint32_t _data) { return __builtin_bswap32(_data); }
|
||||
inline uint64_t swap64(uint64_t _data) { return __builtin_bswap64(_data); }
|
||||
#else
|
||||
// Slow generic implementation. Hopefully this never hits
|
||||
inline uint16_t swap16(uint16_t data) { return (data >> 8) | (data << 8); }
|
||||
inline uint32_t swap32(uint32_t data) { return (swap16(data) << 16) | swap16(data >> 16); }
|
||||
inline uint64_t swap64(uint64_t data) { return ((uint64_t)swap32(data) << 32) | swap32(data >> 32); }
|
||||
#endif
|
||||
|
||||
inline uint16_t swap16(const uint8_t* _pData) { return swap16(*(const uint16_t*)_pData); }
|
||||
inline uint32_t swap32(const uint8_t* _pData) { return swap32(*(const uint32_t*)_pData); }
|
||||
inline uint64_t swap64(const uint8_t* _pData) { return swap64(*(const uint64_t*)_pData); }
|
@ -355,7 +355,6 @@
|
||||
<ClInclude Include="BitScan.h" />
|
||||
<ClInclude Include="BitSet.h" />
|
||||
<ClInclude Include="Buffer.h" />
|
||||
<ClInclude Include="ByteSwap.h" />
|
||||
<ClInclude Include="FakeEmitter.h" />
|
||||
<ClInclude Include="Serialize\SerializeDeque.h" />
|
||||
<ClInclude Include="Serialize\SerializeFuncs.h" />
|
||||
@ -535,4 +534,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -94,7 +94,6 @@
|
||||
</ClInclude>
|
||||
<ClInclude Include="TimeUtil.h" />
|
||||
<ClInclude Include="FakeEmitter.h" />
|
||||
<ClInclude Include="ByteSwap.h" />
|
||||
<ClInclude Include="Buffer.h" />
|
||||
<ClInclude Include="SysError.h" />
|
||||
</ItemGroup>
|
||||
@ -183,4 +182,4 @@
|
||||
<UniqueIdentifier>{7be79ad5-3520-46a1-a370-dce2a943978c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "Core/MIPS/ARM/ArmJit.h"
|
||||
#include "Core/MIPS/ARM/ArmRegCache.h"
|
||||
#include "Common/CPUDetect.h"
|
||||
#include "Common/ByteSwap.h"
|
||||
#include "Common/BitSet.h"
|
||||
|
||||
using namespace MIPSAnalyst;
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "Common/ByteSwap.h"
|
||||
#include "Common/BitSet.h"
|
||||
#include "Common/CPUDetect.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "Core/MIPS/MIPSCodeUtils.h"
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <cstring>
|
||||
#include <utility>
|
||||
|
||||
#include "Common/ByteSwap.h"
|
||||
#include "Common/BitSet.h"
|
||||
#include "Common/Log.h"
|
||||
#include "Core/MIPS/IR/IRInterpreter.h"
|
||||
#include "Core/MIPS/IR/IRPassSimplify.h"
|
||||
|
@ -19,9 +19,9 @@
|
||||
|
||||
#include "math/math_util.h"
|
||||
|
||||
#include "Common/ByteSwap.h"
|
||||
#include "Common/Common.h"
|
||||
#include "Common/BitSet.h"
|
||||
#include "Common/BitScan.h"
|
||||
#include "Common/Common.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/Host.h"
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "Common/ByteSwap.h"
|
||||
#include "Common/BitSet.h"
|
||||
#include "Common/Common.h"
|
||||
#include "Core/MIPS/MIPSCodeUtils.h"
|
||||
#include "Core/MIPS/x86/Jit.h"
|
||||
|
@ -386,7 +386,6 @@
|
||||
<ClInclude Include="..\..\Common\BitScan.h" />
|
||||
<ClInclude Include="..\..\Common\BitSet.h" />
|
||||
<ClInclude Include="..\..\Common\Buffer.h" />
|
||||
<ClInclude Include="..\..\Common\ByteSwap.h" />
|
||||
<ClInclude Include="..\..\Common\Serialize\Serializer.h" />
|
||||
<ClInclude Include="..\..\Common\Serialize\SerializeDeque.h" />
|
||||
<ClInclude Include="..\..\Common\Serialize\SerializeFuncs.h" />
|
||||
|
@ -57,7 +57,6 @@
|
||||
<ClInclude Include="..\..\Common\ArmEmitter.h" />
|
||||
<ClInclude Include="..\..\Common\BitSet.h" />
|
||||
<ClInclude Include="..\..\Common\BitScan.h" />
|
||||
<ClInclude Include="..\..\Common\ByteSwap.h" />
|
||||
<ClInclude Include="..\..\Common\Serialize\Serializer.h" />
|
||||
<ClInclude Include="..\..\Common\Serialize\SerializerDeque.h" />
|
||||
<ClInclude Include="..\..\Common\Serialize\SerializerFuncs.h" />
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "Common/ByteSwap.h"
|
||||
#include "Common/BitSet.h"
|
||||
|
||||
// Should optimize out.
|
||||
#define UTF16_IS_LITTLE_ENDIAN (*(const uint16_t *)"\0\xff" >= 0x100)
|
||||
|
Loading…
Reference in New Issue
Block a user