2015-09-07 11:58:49 +00:00
|
|
|
#ifndef COMPAT_UTIL_H
|
|
|
|
|
#define COMPAT_UTIL_H
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Platform-specific bits
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#if defined(__APPLE__)
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Mach endian conversion
|
|
|
|
|
*/
|
|
|
|
|
# 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)
|
2020-08-07 06:32:24 +00:00
|
|
|
# define le64toh(x) OSSwapLittleToHostInt64(x)
|
2015-09-07 11:58:49 +00:00
|
|
|
|
2019-03-31 23:57:48 +00:00
|
|
|
#elif defined(__FreeBSD__)
|
|
|
|
|
#include <sys/endian.h>
|
|
|
|
|
|
2015-09-07 11:58:49 +00:00
|
|
|
#else // other platforms
|
|
|
|
|
|
|
|
|
|
# include <endian.h>
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
2016-03-31 17:25:32 +00:00
|
|
|
#ifdef MISSING_NANOSLEEP
|
|
|
|
|
#include "clock_nanosleep/clock_nanosleep.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef MISSING_GETTIME
|
2016-03-31 17:38:34 +00:00
|
|
|
#include "clock_gettime/clock_gettime.h"
|
2016-03-31 17:25:32 +00:00
|
|
|
#endif
|
|
|
|
|
|
2015-09-07 11:58:49 +00:00
|
|
|
#endif //COMPAT_UTIL_H
|