Date: Thu, 20 Apr 2006 15:49:05 GMT From: Todd Miller <millert@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 95690 for review Message-ID: <200604201549.k3KFn5DU096759@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=95690 Change 95690 by millert@millert_g5tower on 2006/04/20 15:48:36 Use OSSwapInt* functions for byte swapping. Affected files ... .. //depot/projects/trustedbsd/sedarwin7/src/sedarwin/sedarwin/linux-compat.h#17 edit Differences ... ==== //depot/projects/trustedbsd/sedarwin7/src/sedarwin/sedarwin/linux-compat.h#17 (text+ko) ==== @@ -48,8 +48,11 @@ #include <sys/types.h> /* NOTE: mach sys/types, not BSD one. */ #include <sys/lock.h> /* For atomic operation protos */ -#include <machine/endian.h> /* We need to explicitly include */ -#include <architecture/byte_order.h> /* byte order includes for mach. */ +#ifdef KERNEL +#include <libkern/OSByteOrder.h> +#else +#include <architecture/byte_order.h> +#endif typedef u_int64_t u64; typedef u_int64_t __le64; @@ -71,12 +74,12 @@ #define le32_to_cpu(x) ((__uint32_t)(x)) #define le64_to_cpu(x) ((__uint64_t)(x)) #elif BYTE_ORDER == BIG_ENDIAN -#define cpu_to_le16(x) NXSwapHostShortToLittle(x) -#define cpu_to_le32(x) NXSwapHostLongToLittle(x) -#define cpu_to_le64(x) NXSwapHostLongLongToLittle(x) -#define le16_to_cpu(x) NXSwapLittleShortToHost(x) -#define le32_to_cpu(x) NXSwapLittleLongToHost(x) -#define le64_to_cpu(x) NXSwapLittleLongLongToHost(x) +#define cpu_to_le16(x) OSSwapInt16(x) +#define cpu_to_le32(x) OSSwapInt32(x) +#define cpu_to_le64(x) OSSwapInt64(x) +#define le16_to_cpu(x) OSSwapInt16(x) +#define le32_to_cpu(x) OSSwapInt32(x) +#define le64_to_cpu(x) OSSwapInt64(x) #else #error unsupported BYTE_ORDER #endif /* BYTE_ORDER */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604201549.k3KFn5DU096759>