X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/13fec9890cf095cc781fdf7b8917cb03bf32dd4c..c0fea4742e91338fffdcf79f86a7c1d5e2b97eb1:/bsd/sys/_endian.h diff --git a/bsd/sys/_endian.h b/bsd/sys/_endian.h index 8d0c683b8..6e34f2e70 100644 --- a/bsd/sys/_endian.h +++ b/bsd/sys/_endian.h @@ -83,25 +83,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); @@ -111,16 +96,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) @@ -128,5 +108,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_ */