Attempt to detect and use CoreFoundation's headers for endianness conversions on Mac OS X.

PR:		Issue 21
Submitted by:	MathewMcBride47
This commit is contained in:
Romain Tartiere 2010-09-04 11:06:14 +00:00
parent 8a477773f7
commit b6a4982102
6 changed files with 33 additions and 3 deletions

View file

@ -51,6 +51,20 @@
# define be16toh(x) betoh16(x)
#endif
#if !defined(le32toh) && defined(CFSwapInt32LittleToHost)
# define be32toh(x) CFSwapInt32BigToHost(x)
# define htobe32(x) CFSwapInt32HostToBig(x)
# define le32toh(x) CFSwapInt32LittleToHost(x)
# define htole32(x) CFSwapInt32HostToLittle(x)
#endif
#if !defined(le16toh) && defined(CFSwapInt16LittleToHost)
# define be16toh(x) CFSwapInt16BigToHost(x)
# define htobe16(x) CFSwapInt16HostToBig(x)
# define le16toh(x) CFSwapInt16LittleToHost(x)
# define htole16(x) CFSwapInt16HostToLittle(x)
#endif
#if !defined(le32toh) && defined(bswap_32)
# if BYTE_ORDER == LITTLE_ENDIAN
# define be32toh(x) bswap_32(x)

View file

@ -52,6 +52,10 @@
# include <endian.h>
#endif
#if defined(HAVE_COREFOUNDATION_COREFOUNDATION_H)
# include <CoreFoundation/CoreFoundation.h>
#endif
#if defined(HAVE_BYTESWAP_H)
# include <byteswap.h>
#endif

View file

@ -35,6 +35,10 @@
# include <endian.h>
#endif
#if defined(HAVE_COREFOUNDATION_COREFOUNDATION_H)
# include <CoreFoundation/CoreFoundation.h>
#endif
#if defined(HAVE_BYTESWAP_H)
# include <byteswap.h>
#endif

View file

@ -40,6 +40,10 @@
# include <endian.h>
#endif
#if defined(HAVE_COREFOUNDATION_COREFOUNDATION_H)
# include <CoreFoundation/CoreFoundation.h>
#endif
#if defined(HAVE_BYTESWAP_H)
# include <byteswap.h>
#endif

View file

@ -40,6 +40,10 @@
# include <endian.h>
#endif
#if defined(HAVE_COREFOUNDATION_COREFOUNDATION_H)
# include <CoreFoundation/CoreFoundation.h>
#endif
#if defined(HAVE_BYTESWAP_H)
# include <byteswap.h>
#endif