mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
macosx: Includes/defines for byteswap operations
This commit is contained in:
committed by
Richard W.M. Jones
parent
e39ab27dea
commit
5fc07e87bb
@@ -35,11 +35,22 @@
|
||||
#include <sys/endian.h>
|
||||
#endif
|
||||
|
||||
/* be32toh is usually a macro definend in <endian.h>, but it might be
|
||||
/* be32toh is usually a macro defined in <endian.h>, but it might be
|
||||
* a function in some system so check both, and if neither is defined
|
||||
* then define be32toh for RHEL 5.
|
||||
*/
|
||||
#if !defined(HAVE_BE32TOH) && !defined(be32toh)
|
||||
|
||||
#if defined __APPLE__ && defined __MACH__
|
||||
/* Define/include necessary items on MacOS X */
|
||||
#include <machine/endian.h>
|
||||
#define __BIG_ENDIAN BIG_ENDIAN
|
||||
#define __LITTLE_ENDIAN LITTLE_ENDIAN
|
||||
#define __BYTE_ORDER BYTE_ORDER
|
||||
#include <libkern/OSByteOrder.h>
|
||||
#define __bswap_32 OSSwapConstInt32
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
#define be32toh(x) __bswap_32 (x)
|
||||
#else
|
||||
|
||||
@@ -36,6 +36,12 @@
|
||||
#include <sys/endian.h>
|
||||
#endif
|
||||
|
||||
#if defined __APPLE__ && defined __MACH__
|
||||
#include <libkern/OSByteOrder.h>
|
||||
#define le32toh(x) OSSwapLittleToHostInt32(x)
|
||||
#define le64toh(x) OSSwapLittleToHostInt64(x)
|
||||
#endif
|
||||
|
||||
#include <pcre.h>
|
||||
|
||||
#include "c-ctype.h"
|
||||
|
||||
@@ -35,6 +35,11 @@
|
||||
#include <sys/endian.h>
|
||||
#endif
|
||||
|
||||
#if defined __APPLE__ && defined __MACH__
|
||||
#include <libkern/OSByteOrder.h>
|
||||
#define be64toh(x) OSSwapBigToHostInt64(x)
|
||||
#endif
|
||||
|
||||
#include "full-read.h"
|
||||
|
||||
#include "guestfs.h"
|
||||
|
||||
Reference in New Issue
Block a user