Move SWAP16 to retro_endianness.h

This commit is contained in:
twinaphex 2014-12-30 21:49:45 +01:00
parent 4a7dd62cd3
commit e1691a8d92
2 changed files with 6 additions and 7 deletions

View File

@ -26,6 +26,11 @@
#include <retro_inline.h>
#include <stdint.h>
#define SWAP16(x) ((uint16_t)( \
(((uint16_t)(x) & 0x00ff) << 8) | \
(((uint16_t)(x) & 0xff00) >> 8) \
))
#define SWAP32(x) ((uint32_t)( \
(((uint32_t)(x) & 0x000000ff) << 24) | \
(((uint32_t)(x) & 0x0000ff00) << 8) | \

View File

@ -4,12 +4,6 @@
#include <stdint.h>
#include <retro_endianness.h>
#ifndef swap16
#define swap16(val) \
((((uint16_t)(val) & 0x00ff) << 8) \
| (((uint16_t)(val) & 0xff00) >> 8))
#endif
#ifndef swap64
#define swap64(val) \
((((uint64_t)(val) & 0x00000000000000ffULL) << 56) \
@ -25,7 +19,7 @@
#define httobe64(x) (is_little_endian() ? swap64(x) : (x))
#define httobe32(x) (is_little_endian() ? SWAP32(x) : (x))
#define httobe16(x) (is_little_endian() ? swap16(x) : (x))
#define httobe16(x) (is_little_endian() ? SWAP16(x) : (x))
#define betoht16(x) httobe16(x)
#define betoht32(x) httobe32(x)