X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/8ad349bb6ed4a0be06e34c92be0d98b92e078db4..5d5c5d0d5b79ade9a973d55186ffda2638ba2b6e:/bsd/sys/_endian.h diff --git a/bsd/sys/_endian.h b/bsd/sys/_endian.h index 82bbe4611..e423f5dd9 100644 --- a/bsd/sys/_endian.h +++ b/bsd/sys/_endian.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. - * + * Copyright (c) 2004 Apple Computer, Inc. All rights reserved. + * * @APPLE_LICENSE_OSREFERENCE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code @@ -99,25 +99,10 @@ /* * Macros for network/external number representation conversion. */ -#if __DARWIN_BYTE_ORDER == __DARWIN_BIG_ENDIAN && !defined(lint) -#define ntohl(x) (x) -#define ntohs(x) (x) -#define htonl(x) (x) -#define htons(x) (x) - -#if defined(KERNEL) || !defined(_POSIX_C_SOURCE) -#define NTOHL(x) (x) -#define NTOHS(x) (x) -#define HTONL(x) (x) -#define HTONS(x) (x) -#endif /* defined(KERNEL) || !defined(_POSIX_C_SOURCE) */ - -#else - #if !defined(__ASSEMBLER__) #include -#include +#include __BEGIN_DECLS uint16_t ntohs(uint16_t); @@ -127,16 +112,11 @@ uint32_t htonl(uint32_t); __END_DECLS #endif /* !defined(__ASSEMBLER__) */ -#define ntohs(x) NXSwapBigShortToHost(x) -#define htons(x) NXSwapHostShortToBig(x) +#define ntohs(x) OSSwapBigToHostInt16(x) +#define htons(x) OSSwapHostToBigInt16(x) -#if defined(__LP64__) -#define ntohl(x) NXSwapBigIntToHost(x) -#define htonl(x) NXSwapHostIntToBig(x) -#else -#define ntohl(x) NXSwapBigLongToHost(x) -#define htonl(x) NXSwapHostLongToBig(x) -#endif /* defined(__LP64__) */ +#define ntohl(x) OSSwapBigToHostInt32(x) +#define htonl(x) OSSwapHostToBigInt32(x) #if defined(KERNEL) || !defined(_POSIX_C_SOURCE) #define NTOHL(x) (x) = ntohl((u_long)x) @@ -144,5 +124,4 @@ __END_DECLS #define HTONL(x) (x) = htonl((u_long)x) #define HTONS(x) (x) = htons((u_short)x) #endif /* defined(KERNEL) || !defined(_POSIX_C_SOURCE) */ -#endif /* __DARWIN_BYTE_ORDER != __DARWIN_BIG_ENDIAN || defined(lint) */ #endif /* !_SYS__ENDIAN_H_ */