From 46bd857cc275e4fa103a3a7d7033350634c65770 Mon Sep 17 00:00:00 2001 From: "git@daemon.de" Date: Mon, 24 Aug 2015 20:15:09 +0200 Subject: [PATCH] added osx support --- include/pcp/platform.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/pcp/platform.h b/include/pcp/platform.h index 6234ce8..2c84264 100644 --- a/include/pcp/platform.h +++ b/include/pcp/platform.h @@ -45,6 +45,18 @@ # define htobe32(x) (x) # define be64toh(x) (x) # define htobe64(x) (x) +# elif defined(__APPLE__) /* from https://gist.github.com/panzi/6856583 */ +# include +# define htobe16(x) OSSwapHostToBigInt16(x) +# define be16toh(x) OSSwapBigToHostInt16(x) +# define htobe32(x) OSSwapHostToBigInt32(x) +# define be32toh(x) OSSwapBigToHostInt32(x) +# define htobe64(x) OSSwapHostToBigInt64(x) +# define be64toh(x) OSSwapBigToHostInt64(x) +# define __BYTE_ORDER BYTE_ORDER +# define __BIG_ENDIAN BIG_ENDIAN +# define __LITTLE_ENDIAN LITTLE_ENDIAN +# define __PDP_ENDIAN PDP_ENDIAN # else # ifdef HAVE_ARPA_INET_H # include