201e41fc31
* Replace __byte_swap_32_variable() with a C version from Richard Earnshaw that generates nearly identical assembly (and it would be exactly identical with the addition of another peephole to GCC ARM back-end).
22 lines
574 B
C
22 lines
574 B
C
/* $NetBSD: endian_machdep.h,v 1.5 2002/08/14 15:08:58 thorpej Exp $ */
|
|
|
|
/* GCC predefines __ARMEB__ when building for big-endian ARM. */
|
|
#ifdef __ARMEB__
|
|
#define _BYTE_ORDER _BIG_ENDIAN
|
|
#else
|
|
#define _BYTE_ORDER _LITTLE_ENDIAN
|
|
#endif
|
|
|
|
#ifdef __GNUC__
|
|
|
|
#include <arm/byte_swap.h>
|
|
|
|
#if _BYTE_ORDER == _LITTLE_ENDIAN
|
|
#define ntohl(x) ((in_addr_t)__byte_swap_32((in_addr_t)(x)))
|
|
#define ntohs(x) ((in_port_t)__byte_swap_16((in_port_t)(x)))
|
|
#define htonl(x) ((in_addr_t)__byte_swap_32((in_addr_t)(x)))
|
|
#define htons(x) ((in_port_t)__byte_swap_16((in_port_t)(x)))
|
|
#endif
|
|
|
|
#endif
|