From 2aa494dcfe701e080e62f3d2a36af84b2ee16837 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Tue, 13 Feb 2007 16:41:51 -0500 Subject: MacOS X has a defective sed with no -r. --- lib/portability.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'lib/portability.h') diff --git a/lib/portability.h b/lib/portability.h index 9f3f1b78..6ed1dc4f 100644 --- a/lib/portability.h +++ b/lib/portability.h @@ -1,13 +1,30 @@ - // Humor glibc to get dprintf, then #define it to something more portable. #define _GNU_SOURCE #include #define fdprintf(...) dprintf(__VA_ARGS__) + +#ifndef __APPLE__ +#include #include #if __BYTE_ORDER == __BIG_ENDIAN #define IS_BIG_ENDIAN 1 +#else +#define IS_BIG_ENDIAN 0 +#endif + +#else + +#ifdef __BIG_ENDIAN__ +#define IS_BIG_ENDIAN 1 +#else +#define IS_BIG_ENDIAN 0 +#endif + +#endif + +#if IS_BIG_ENDIAN #define IS_LITTLE_ENDIAN 0 #define SWAP_BE16(x) (x) #define SWAP_BE32(x) (x) @@ -17,7 +34,6 @@ #define SWAP_LE64(x) bswap_64(x) #else #define IS_LITTLE_ENDIAN 1 -#define IS_BIG_ENDIAN 0 #define SWAP_BE16(x) bswap_16(x) #define SWAP_BE32(x) bswap_32(x) #define SWAP_BE64(x) bswap_64(x) -- cgit v1.2.3