From c4ffc08b66354f9c5f5c582c559dc6ba0b2b5ea8 Mon Sep 17 00:00:00 2001 From: cognet Date: Tue, 18 Jan 2005 15:51:50 +0000 Subject: [PATCH] Start to support the big endian case as well. --- sys/arm/include/endian.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sys/arm/include/endian.h b/sys/arm/include/endian.h index d3c4c9816e0c..093a57011c91 100644 --- a/sys/arm/include/endian.h +++ b/sys/arm/include/endian.h @@ -43,7 +43,11 @@ #define _BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ #define _PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ +#ifdef __ARMEB__ +#define _BYTE_ORDER _BIG_ENDIAN +#else #define _BYTE_ORDER _LITTLE_ENDIAN +#endif /* __ARMEB__ */ #if __BSD_VISIBLE #define LITTLE_ENDIAN _LITTLE_ENDIAN @@ -52,12 +56,21 @@ #define BYTE_ORDER _BYTE_ORDER #endif +#ifdef __ARMEB__ +#define _QUAD_HIGHWORD 0 +#define _QUAD_LOWWORD 1 +#define __ntohl(x) ((__uint32_t)(x)) +#define __ntohs(x) ((__uint16_t)(x)) +#define __htonl(x) ((__uint32_t)(x)) +#define __htons(x) ((__uint16_t)(x)) +#else #define _QUAD_HIGHWORD 1 #define _QUAD_LOWWORD 0 #define __ntohl(x) (__bswap32(x)) #define __ntohs(x) (__bswap16(x)) #define __htonl(x) (__bswap32(x)) #define __htons(x) (__bswap16(x)) +#endif /* __ARMEB__ */ static __inline __uint64_t __bswap64(__uint64_t _x)