From e1691a8d928d277acb439b3fc79be5cc1a3a888c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 30 Dec 2014 21:49:45 +0100 Subject: [PATCH] Move SWAP16 to retro_endianness.h --- libretro-sdk/include/retro_endianness.h | 5 +++++ rarchdb/rarchdb_endian.h | 8 +------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/libretro-sdk/include/retro_endianness.h b/libretro-sdk/include/retro_endianness.h index a161ac0d62..baf98b74f8 100644 --- a/libretro-sdk/include/retro_endianness.h +++ b/libretro-sdk/include/retro_endianness.h @@ -26,6 +26,11 @@ #include #include +#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) | \ diff --git a/rarchdb/rarchdb_endian.h b/rarchdb/rarchdb_endian.h index 20b3e450e1..11a0c39341 100644 --- a/rarchdb/rarchdb_endian.h +++ b/rarchdb/rarchdb_endian.h @@ -4,12 +4,6 @@ #include #include -#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)