Wider endianness support
[fio.git] / os / os-mac.h
index eb55cd7742fa4a7dee86e5122273f2a33362608c..24e0eb5d157b8db0c292bd15fb1b3a6508e28981 100644 (file)
@@ -9,6 +9,8 @@
 #include <unistd.h>
 #include <signal.h>
 #include <mach/mach_init.h>
+#include <machine/endian.h>
+#include <libkern/OSByteOrder.h>
 
 #include "../file.h"
 
 
 #define OS_MAP_ANON            MAP_ANON
 
+#if defined(__LITTLE_ENDIAN__)
+#define FIO_LITTLE_ENDIAN
+#elif defined(__BIG_ENDIAN__)
+#define FIO_BIG_ENDIAN
+#else
+#error "Undefined byte order"
+#endif
+
+#define fio_swap16(x)  OSSwapInt16(x)
+#define fio_swap32(x)  OSSwapInt32(x)
+#define fio_swap64(x)  OSSwapInt64(x)
+
 /*
  * OSX has a pitifully small shared memory segment by default,
  * so default to a lower number of max jobs supported