From 047548b30bd5807c3b878bebde9209e7fe368148 Mon Sep 17 00:00:00 2001 From: Andrey Fedorov Date: Fri, 5 Oct 2012 11:31:45 -0400 Subject: [PATCH] fix for building on OSX Copied from this fink package: http://mirror.lug.udel.edu/pub/fink/finkinfo/10.7/stable/main/finkinfo/d evel/endian-dev.info --- src/utils.h | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/utils.h b/src/utils.h index 3237d6d555..5b4d184e73 100644 --- a/src/utils.h +++ b/src/utils.h @@ -25,11 +25,22 @@ extern uint64_t be64toh(uint64_t value); extern uint32_t htobe32(uint32_t value); extern uint32_t be32toh(uint32_t value); #elif __APPLE__ -#define be16toh(x) betoh16(x) -#define be32toh(x) betoh32(x) -#define be64toh(x) betoh64(x) -#define h64tobe(x) htobe64(x) -#define h32tobe(x) htobe32(x) +#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