ByteOrder.h: remove use of __builtin_bswap16.
* Fixes the build for host compilers older than gcc-4.8
This commit is contained in:
parent
d0592a1164
commit
040dc2eebc
@ -29,6 +29,11 @@ typedef enum {
|
|||||||
# define ntohl(x) B_BENDIAN_TO_HOST_INT32(x)
|
# define ntohl(x) B_BENDIAN_TO_HOST_INT32(x)
|
||||||
# define htons(x) B_HOST_TO_BENDIAN_INT16(x)
|
# define htons(x) B_HOST_TO_BENDIAN_INT16(x)
|
||||||
# define ntohs(x) B_BENDIAN_TO_HOST_INT16(x)
|
# define ntohs(x) B_BENDIAN_TO_HOST_INT16(x)
|
||||||
|
|
||||||
|
static inline uint16 __swap_int16(uint16 arg)
|
||||||
|
{
|
||||||
|
return (arg >> 8) | (arg << 8);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* always swap macros */
|
/* always swap macros */
|
||||||
@ -123,11 +128,9 @@ extern float __swap_float(float arg);
|
|||||||
#if __GNUC__ >= 4
|
#if __GNUC__ >= 4
|
||||||
#define __swap_int64(arg) __builtin_bswap64(arg)
|
#define __swap_int64(arg) __builtin_bswap64(arg)
|
||||||
#define __swap_int32(arg) __builtin_bswap32(arg)
|
#define __swap_int32(arg) __builtin_bswap32(arg)
|
||||||
#define __swap_int16(arg) __builtin_bswap16(arg)
|
|
||||||
#else
|
#else
|
||||||
extern uint64 __swap_int64(uint64 arg);
|
extern uint64 __swap_int64(uint64 arg);
|
||||||
extern uint32 __swap_int32(uint32 arg);
|
extern uint32 __swap_int32(uint32 arg);
|
||||||
extern uint16 __swap_int16(uint16 arg);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -31,6 +31,10 @@ typedef uint32_t in_addr_t;
|
|||||||
# else
|
# else
|
||||||
extern unsigned int __swap_int32(unsigned int); /* private */
|
extern unsigned int __swap_int32(unsigned int); /* private */
|
||||||
# endif
|
# endif
|
||||||
|
static inline uint16_t __swap_int16(uint16_t arg)
|
||||||
|
{
|
||||||
|
return (arg >> 8) | (arg << 8);
|
||||||
|
}
|
||||||
extern uint16_t __swap_int16(uint16_t); /* private */
|
extern uint16_t __swap_int16(uint16_t); /* private */
|
||||||
# if BYTE_ORDER == LITTLE_ENDIAN
|
# if BYTE_ORDER == LITTLE_ENDIAN
|
||||||
# define htonl(x) ((uint32_t)__swap_int32(x))
|
# define htonl(x) ((uint32_t)__swap_int32(x))
|
||||||
|
@ -7,12 +7,6 @@
|
|||||||
|
|
||||||
#include <ByteOrder.h>
|
#include <ByteOrder.h>
|
||||||
|
|
||||||
uint16
|
|
||||||
__swap_int16(uint16 value)
|
|
||||||
{
|
|
||||||
return (value >> 8) | (value << 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32
|
uint32
|
||||||
__swap_int32(uint32 value)
|
__swap_int32(uint32 value)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user