xref: /netbsd/sys/arch/arm/include/endian_machdep.h (revision c4a72b64)
1 /* $NetBSD: endian_machdep.h,v 1.5 2002/08/14 15:08:58 thorpej Exp $ */
2 
3 /* GCC predefines __ARMEB__ when building for big-endian ARM. */
4 #ifdef __ARMEB__
5 #define _BYTE_ORDER _BIG_ENDIAN
6 #else
7 #define _BYTE_ORDER _LITTLE_ENDIAN
8 #endif
9 
10 #ifdef __GNUC__
11 
12 #include <arm/byte_swap.h>
13 
14 #if _BYTE_ORDER == _LITTLE_ENDIAN
15 #define	ntohl(x)	((in_addr_t)__byte_swap_32((in_addr_t)(x)))
16 #define	ntohs(x)	((in_port_t)__byte_swap_16((in_port_t)(x)))
17 #define	htonl(x)	((in_addr_t)__byte_swap_32((in_addr_t)(x)))
18 #define	htons(x)	((in_port_t)__byte_swap_16((in_port_t)(x)))
19 #endif
20 
21 #endif
22