mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 04:20:28 +00:00
Move SWAP16 to retro_endianness.h
This commit is contained in:
parent
4a7dd62cd3
commit
e1691a8d92
@ -26,6 +26,11 @@
|
|||||||
#include <retro_inline.h>
|
#include <retro_inline.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define SWAP16(x) ((uint16_t)( \
|
||||||
|
(((uint16_t)(x) & 0x00ff) << 8) | \
|
||||||
|
(((uint16_t)(x) & 0xff00) >> 8) \
|
||||||
|
))
|
||||||
|
|
||||||
#define SWAP32(x) ((uint32_t)( \
|
#define SWAP32(x) ((uint32_t)( \
|
||||||
(((uint32_t)(x) & 0x000000ff) << 24) | \
|
(((uint32_t)(x) & 0x000000ff) << 24) | \
|
||||||
(((uint32_t)(x) & 0x0000ff00) << 8) | \
|
(((uint32_t)(x) & 0x0000ff00) << 8) | \
|
||||||
|
@ -4,12 +4,6 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <retro_endianness.h>
|
#include <retro_endianness.h>
|
||||||
|
|
||||||
#ifndef swap16
|
|
||||||
#define swap16(val) \
|
|
||||||
((((uint16_t)(val) & 0x00ff) << 8) \
|
|
||||||
| (((uint16_t)(val) & 0xff00) >> 8))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef swap64
|
#ifndef swap64
|
||||||
#define swap64(val) \
|
#define swap64(val) \
|
||||||
((((uint64_t)(val) & 0x00000000000000ffULL) << 56) \
|
((((uint64_t)(val) & 0x00000000000000ffULL) << 56) \
|
||||||
@ -25,7 +19,7 @@
|
|||||||
|
|
||||||
#define httobe64(x) (is_little_endian() ? swap64(x) : (x))
|
#define httobe64(x) (is_little_endian() ? swap64(x) : (x))
|
||||||
#define httobe32(x) (is_little_endian() ? SWAP32(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 betoht16(x) httobe16(x)
|
||||||
#define betoht32(x) httobe32(x)
|
#define betoht32(x) httobe32(x)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user