dump1090/compat/util.h
David Stipp ae126d1009 Add back Darwin/Mach/Apple portability
Quite a few of the changes against the MalcolmRobb/dump1090 fork are
incompatible with OSX.  This patch adds back that cross platform support
back.
2015-09-05 14:42:11 -04:00

21 lines
459 B
C

#ifndef COMPAT_UTIL_H
#define COMPAT_UTIL_H
#include "clock_gettime/clock_gettime.h"
#include "clock_nanosleep/clock_nanosleep.h"
/*
* Mach endian conversion
*/
#if defined(__APPLE__)
#include <libkern/OSByteOrder.h>
#define bswap_16 OSSwapInt16
#define bswap_32 OSSwapInt32
#define bswap_64 OSSwapInt64
#include <machine/endian.h>
#define le16toh(x) OSSwapLittleToHostInt16(x)
#define le32toh(x) OSSwapLittleToHostInt32(x)
#endif
#endif //COMPAT_UTIL_H