diff options
author | Olivier Houchard <cognet@FreeBSD.org> | 2005-01-18 15:51:50 +0000 |
---|---|---|
committer | Olivier Houchard <cognet@FreeBSD.org> | 2005-01-18 15:51:50 +0000 |
commit | 12a58da422d3a75884c1d3c386f4679da8c43536 (patch) | |
tree | e94066e0a53748f230ae969eda80c0b922795545 /sys/arm/include/endian.h | |
parent | 929ab920ae118d8ed0dbd759e095de5534feb4be (diff) |
Start to support the big endian case as well.
Notes
Notes:
svn path=/head/; revision=140425
Diffstat (limited to 'sys/arm/include/endian.h')
-rw-r--r-- | sys/arm/include/endian.h | 13 |
1 files changed, 13 insertions, 0 deletions
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) |