23 #ifndef __LIBRETRO_SDK_ENDIANNESS_H 24 #define __LIBRETRO_SDK_ENDIANNESS_H 30 #if defined(_MSC_VER) && _MSC_VER > 1200 31 #define SWAP16 _byteswap_ushort 32 #define SWAP32 _byteswap_ulong 34 #define SWAP16(x) ((uint16_t)( \ 35 (((uint16_t)(x) & 0x00ff) << 8) | \ 36 (((uint16_t)(x) & 0xff00) >> 8) \ 38 #define SWAP32(x) ((uint32_t)( \ 39 (((uint32_t)(x) & 0x000000ff) << 24) | \ 40 (((uint32_t)(x) & 0x0000ff00) << 8) | \ 41 (((uint32_t)(x) & 0x00ff0000) >> 8) | \ 42 (((uint32_t)(x) & 0xff000000) >> 24) \ 46 #if defined(_MSC_VER) && _MSC_VER <= 1200 48 ((((uint64_t)(val) & 0x00000000000000ff) << 56) \ 49 | (((uint64_t)(val) & 0x000000000000ff00) << 40) \ 50 | (((uint64_t)(val) & 0x0000000000ff0000) << 24) \ 51 | (((uint64_t)(val) & 0x00000000ff000000) << 8) \ 52 | (((uint64_t)(val) & 0x000000ff00000000) >> 8) \ 53 | (((uint64_t)(val) & 0x0000ff0000000000) >> 24) \ 54 | (((uint64_t)(val) & 0x00ff000000000000) >> 40) \ 55 | (((uint64_t)(val) & 0xff00000000000000) >> 56)) 58 ((((uint64_t)(val) & 0x00000000000000ffULL) << 56) \ 59 | (((uint64_t)(val) & 0x000000000000ff00ULL) << 40) \ 60 | (((uint64_t)(val) & 0x0000000000ff0000ULL) << 24) \ 61 | (((uint64_t)(val) & 0x00000000ff000000ULL) << 8) \ 62 | (((uint64_t)(val) & 0x000000ff00000000ULL) >> 8) \ 63 | (((uint64_t)(val) & 0x0000ff0000000000ULL) >> 24) \ 64 | (((uint64_t)(val) & 0x00ff000000000000ULL) >> 40) \ 65 | (((uint64_t)(val) & 0xff00000000000000ULL) >> 56)) 76 #if defined(MSB_FIRST) 77 #define is_little_endian() (0) 78 #elif defined(__x86_64) || defined(__i386) || defined(_M_IX86) || defined(_M_X64) 79 #define is_little_endian() (1) 104 #if defined(MSB_FIRST) 105 #define swap_if_big64(val) (SWAP64(val)) 106 #elif defined(__x86_64) || defined(__i386) || defined(_M_IX86) || defined(_M_X64) 107 #define swap_if_big64(val) (val) 127 #if defined(MSB_FIRST) 128 #define swap_if_big32(val) (SWAP32(val)) 129 #elif defined(__x86_64) || defined(__i386) || defined(_M_IX86) || defined(_M_X64) 130 #define swap_if_big32(val) (val) 150 #if defined(MSB_FIRST) 151 #define swap_if_little64(val) (val) 152 #elif defined(__x86_64) || defined(__i386) || defined(_M_IX86) || defined(_M_X64) 153 #define swap_if_little64(val) (SWAP64(val)) 173 #if defined(MSB_FIRST) 174 #define swap_if_little32(val) (val) 175 #elif defined(__x86_64) || defined(__i386) || defined(_M_IX86) || defined(_M_X64) 176 #define swap_if_little32(val) (SWAP32(val)) 196 #if defined(MSB_FIRST) 197 #define swap_if_big16(val) (SWAP16(val)) 198 #elif defined(__x86_64) || defined(__i386) || defined(_M_IX86) || defined(_M_X64) 199 #define swap_if_big16(val) (val) 219 #if defined(MSB_FIRST) 220 #define swap_if_little16(val) (val) 221 #elif defined(__x86_64) || defined(__i386) || defined(_M_IX86) || defined(_M_X64) 222 #define swap_if_little16(val) (SWAP16(val)) GLuint GLfloat * val
Definition: glext.h:7847
#define INLINE
Definition: retro_inline.h:35
#define SWAP32(x)
Definition: retro_endianness.h:38
#define SWAP16(x)
Definition: retro_endianness.h:34
static INLINE uint32_t swap_if_big32(uint32_t val)
Definition: retro_endianness.h:132
static INLINE uint32_t swap_if_little32(uint32_t val)
Definition: retro_endianness.h:178
static INLINE uint32_t load32be(const uint32_t *addr)
Definition: retro_endianness.h:253
static INLINE uint64_t swap_if_big64(uint64_t val)
Definition: retro_endianness.h:109
static INLINE uint16_t swap_if_little16(uint16_t val)
Definition: retro_endianness.h:224
GLenum const GLvoid * addr
Definition: glext.h:10528
static INLINE uint64_t swap_if_little64(uint64_t val)
Definition: retro_endianness.h:155
static INLINE uint8_t is_little_endian(void)
Definition: retro_endianness.h:81
GLint GLint GLint GLint GLint GLint y
Definition: glext.h:6295
GLint GLint GLint GLint GLint x
Definition: glext.h:6295
static INLINE void store32be(uint32_t *addr, uint32_t data)
Definition: retro_endianness.h:240
static INLINE uint16_t swap_if_big16(uint16_t val)
Definition: retro_endianness.h:201
#define SWAP64(val)
Definition: retro_endianness.h:57
unsigned short uint16_t
Definition: stdint.h:125
unsigned __int64 uint64_t
Definition: stdint.h:136
unsigned char uint8_t
Definition: stdint.h:124
unsigned int uint32_t
Definition: stdint.h:126