[BACK]Return to byteorder.h CVS log [TXT][DIR] Up to [Development] / xfs-cmds / acl / libacl

File: [Development] / xfs-cmds / acl / libacl / byteorder.h (download)

Revision 1.3, Wed Jul 10 04:12:35 2002 UTC (15 years, 3 months ago) by nathans
Branch: MAIN
CVS Tags: XFS-1_3_0pre1, HEAD
Changes since 1.2: +5 -3 lines

Fix configure warning (autoconf 2.13) - namely:
"AC_TRY_RUN called without default to allow cross compiling"

#include <endian.h>

#if __BYTE_ORDER == __BIG_ENDIAN
# define cpu_to_le16(w16) le16_to_cpu(w16)
# define le16_to_cpu(w16) ((u_int16_t)((u_int16_t)(w16) >> 8) | \
                           (u_int16_t)((u_int16_t)(w16) << 8))
# define cpu_to_le32(w32) le32_to_cpu(w32)
# define le32_to_cpu(w32) ((u_int32_t)( (u_int32_t)(w32) >>24) | \
                           (u_int32_t)(((u_int32_t)(w32) >> 8) & 0xFF00) | \
                           (u_int32_t)(((u_int32_t)(w32) << 8) & 0xFF0000) | \
			   (u_int32_t)( (u_int32_t)(w32) <<24))
#elif __BYTE_ORDER == __LITTLE_ENDIAN
# define cpu_to_le16(w16) ((u_int16_t)(w16))
# define le16_to_cpu(w16) ((u_int16_t)(w16))
# define cpu_to_le32(w32) ((u_int32_t)(w32))
# define le32_to_cpu(w32) ((u_int32_t)(w32))
#else
# error unknown endianess?
#endif