1 /* $NetBSD: endian_machdep.h,v 1.7 2005/12/11 12:16:47 christos 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) ((uint32_t)__byte_swap_32((uint32_t)(x))) 16 #define ntohs(x) ((uint16_t)__byte_swap_16((uint16_t)(x))) 17 #define htonl(x) ((uint32_t)__byte_swap_32((uint32_t)(x))) 18 #define htons(x) ((uint16_t)__byte_swap_16((uint16_t)(x))) 19 #endif 20 21 #endif 22