OS X compatibility cleanups.
Reattach the licenses for the compat stuff to the source. Only build/link the compat stuff when it's needed. Rename compat/util.h so it's not confused with util.h. Move all the platform specific defines inside compat/compat.h.
This commit is contained in:
parent
ae126d1009
commit
1c80d1b784
12 changed files with 114 additions and 82 deletions
32
compat/compat.h
Normal file
32
compat/compat.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#ifndef COMPAT_UTIL_H
|
||||
#define COMPAT_UTIL_H
|
||||
|
||||
/*
|
||||
* Platform-specific bits
|
||||
*/
|
||||
|
||||
#if defined(__APPLE__)
|
||||
|
||||
/* implementations of clock_gettime, clock_nanosleep */
|
||||
|
||||
#include "clock_gettime/clock_gettime.h"
|
||||
#include "clock_nanosleep/clock_nanosleep.h"
|
||||
|
||||
/*
|
||||
* 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)
|
||||
|
||||
#else // other platforms
|
||||
|
||||
# include <endian.h>
|
||||
|
||||
#endif
|
||||
|
||||
#endif //COMPAT_UTIL_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue