Use __BIG_ENDIAN__ macro

This commit is contained in:
Iliyas Jorio 2022-09-02 19:23:28 +02:00
parent 501ac5dfeb
commit 7f16782991
3 changed files with 5 additions and 5 deletions

View File

@ -19,7 +19,7 @@ typedef unsigned short UInt16;
typedef unsigned int UInt32;
typedef unsigned long long UInt64;
#if TARGET_RT_BIGENDIAN
#if __BIG_ENDIAN__
typedef struct { UInt32 hi, lo; } UnsignedWide;
#else
typedef struct { UInt32 lo, hi; } UnsignedWide;
@ -283,7 +283,7 @@ typedef UInt8 KeyMapByteArray[16];
//-----------------------------------------------------------------------------
// 'vers' resource
#if TARGET_RT_BIG_ENDIAN
#if __BIG_ENDIAN__
//BCD encoded, e.g. "4.2.1a3" is 0x04214003
typedef struct NumVersion
{

View File

@ -48,7 +48,7 @@ namespace Pomme
{
char b[sizeof(T)];
Read(b, sizeof(T));
#if !(TARGET_RT_BIGENDIAN)
#if !(__BIG_ENDIAN__)
if constexpr (sizeof(T) > 1)
{
std::reverse(b, b + sizeof(T));
@ -80,7 +80,7 @@ namespace Pomme
void Write(T value)
{
char* b = (char*) &value;
#if !(TARGET_RT_BIGENDIAN)
#if !(__BIG_ENDIAN__)
if constexpr (sizeof(T) > 1)
{
std::reverse(b, b + sizeof(T));

View File

@ -8,7 +8,7 @@
template<typename T> T ByteswapScalar(T x)
{
#if TARGET_RT_BIGENDIAN
#if __BIG_ENDIAN__
return x;
#else
char* b = (char*)&x;