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:
parent
8a477773f7
commit
b6a4982102
6 changed files with 33 additions and 3 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue