X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libpcsxcore%2Fpsxmem.h;h=ec4b970a6710a910c54db88bfc281b9adc3c8c28;hb=70c1043e63dafcf92b0f4dc0932326a6d042fbb4;hp=fbf5f67c74ff2e9e7bdc500d131463737bffb989;hpb=41e82ad46e60f9c3291ff81ebe4a07512b1194c5;p=pcsx_rearmed.git diff --git a/libpcsxcore/psxmem.h b/libpcsxcore/psxmem.h index fbf5f67c..ec4b970a 100644 --- a/libpcsxcore/psxmem.h +++ b/libpcsxcore/psxmem.h @@ -26,13 +26,10 @@ extern "C" { #include "psxcommon.h" -#if defined(__BIGENDIAN__) +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ -#define _SWAP16(b) ((((unsigned char *)&(b))[0] & 0xff) | (((unsigned char *)&(b))[1] & 0xff) << 8) -#define _SWAP32(b) ((((unsigned char *)&(b))[0] & 0xff) | ((((unsigned char *)&(b))[1] & 0xff) << 8) | ((((unsigned char *)&(b))[2] & 0xff) << 16) | (((unsigned char *)&(b))[3] << 24)) - -#define SWAP16(v) ((((v) & 0xff00) >> 8) +(((v) & 0xff) << 8)) -#define SWAP32(v) ((((v) & 0xff000000ul) >> 24) + (((v) & 0xff0000ul) >> 8) + (((v) & 0xff00ul)<<8) +(((v) & 0xfful) << 24)) +#define SWAP16(v) __builtin_bswap16(v) +#define SWAP32(v) __builtin_bswap32(v) #define SWAPu32(v) SWAP32((u32)(v)) #define SWAPs32(v) SWAP32((s32)(v))