From 323c477aff315f3495d93618a7a51c93c1ca7156 Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Thu, 19 Nov 2015 10:15:32 +0100 Subject: [PATCH] define endianness macros for OS X portability --- pdns/iputils.hh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pdns/iputils.hh b/pdns/iputils.hh index ddc8414163..5cd6f87808 100644 --- a/pdns/iputils.hh +++ b/pdns/iputils.hh @@ -41,6 +41,25 @@ #include "namespaces.hh" +#ifdef __APPLE__ +#include + +#define htobe16(x) OSSwapHostToBigInt16(x) +#define htole16(x) OSSwapHostToLittleInt16(x) +#define be16toh(x) OSSwapBigToHostInt16(x) +#define le16toh(x) OSSwapLittleToHostInt16(x) + +#define htobe32(x) OSSwapHostToBigInt32(x) +#define htole32(x) OSSwapHostToLittleInt32(x) +#define be32toh(x) OSSwapBigToHostInt32(x) +#define le32toh(x) OSSwapLittleToHostInt32(x) + +#define htobe64(x) OSSwapHostToBigInt64(x) +#define htole64(x) OSSwapHostToLittleInt64(x) +#define be64toh(x) OSSwapBigToHostInt64(x) +#define le64toh(x) OSSwapLittleToHostInt64(x) +#endif + union ComboAddress { struct sockaddr_in sin4; struct sockaddr_in6 sin6; -- 2.47.2