diff options
Diffstat (limited to 'sys/cddl/compat/opensolaris/sys/byteorder.h')
-rw-r--r-- | sys/cddl/compat/opensolaris/sys/byteorder.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/cddl/compat/opensolaris/sys/byteorder.h b/sys/cddl/compat/opensolaris/sys/byteorder.h index a8f8bc2..72ae45b 100644 --- a/sys/cddl/compat/opensolaris/sys/byteorder.h +++ b/sys/cddl/compat/opensolaris/sys/byteorder.h @@ -59,9 +59,31 @@ * Macros to convert from a specific byte order to/from native byte order */ #if _BYTE_ORDER == _BIG_ENDIAN +#define BE_8(x) BMASK_8(x) +#define BE_16(x) BMASK_16(x) +#define BE_32(x) BMASK_32(x) +#define BE_64(x) BMASK_64(x) +#define LE_8(x) BSWAP_8(x) +#define LE_16(x) BSWAP_16(x) +#define LE_32(x) BSWAP_32(x) #define LE_64(x) BSWAP_64(x) #else +#define LE_8(x) BMASK_8(x) +#define LE_16(x) BMASK_16(x) +#define LE_32(x) BMASK_32(x) #define LE_64(x) BMASK_64(x) +#define BE_8(x) BSWAP_8(x) +#define BE_16(x) BSWAP_16(x) +#define BE_32(x) BSWAP_32(x) +#define BE_64(x) BSWAP_64(x) +#endif + +#if _BYTE_ORDER == _BIG_ENDIAN +#define htonll(x) BMASK_64(x) +#define ntohll(x) BMASK_64(x) +#else +#define htonll(x) BSWAP_64(x) +#define ntohll(x) BSWAP_64(x) #endif #endif /* _OPENSOLARIS_SYS_BYTEORDER_H_ */ |