From eb652a71c7ddcae0830b7a2576069a575b95d604 Mon Sep 17 00:00:00 2001 From: Fabio Utzig Date: Fri, 23 Jan 2015 18:36:11 -0200 Subject: [PATCH] Add missing endian macros on OS X --- compression.cc | 1 + endian.hh | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/compression.cc b/compression.cc index 151a240..ccf0ab9 100644 --- a/compression.cc +++ b/compression.cc @@ -5,6 +5,7 @@ #include "compression.hh" #include "check.hh" +#include "endian.hh" namespace Compression { diff --git a/endian.hh b/endian.hh index 767d10b..612573b 100644 --- a/endian.hh +++ b/endian.hh @@ -6,9 +6,27 @@ #include #include + #ifdef __APPLE__ #include -#else +#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) + +#else // __APPLE__ #include #endif