Add support for OpenBSD

This commit is contained in:
Tom Davis
2016-07-20 18:19:31 -04:00
parent a0f6e100f1
commit c0366147e8

View File

@@ -14,13 +14,17 @@
* the License. * the License.
*/ */
#if defined(__linux) #if defined(__linux)
#include <byteswap.h> # include <byteswap.h>
#elif defined(__APPLE__) #elif defined(__APPLE__)
#include <libkern/OSByteOrder.h> # include <libkern/OSByteOrder.h>
#define bswap_32 OSSwapInt32 # define bswap_32 OSSwapInt32
#define bswap_64 OSSwapInt64 # define bswap_64 OSSwapInt64
#elif defined(__OpenBSD__)
# include <endian.h>
# define bswap_32 swap32
# define bswap_64 swap64
#else #else
#error "no byteswap.h or libkern/OSByteOrder.h" # error "no byteswap.h or libkern/OSByteOrder.h"
#endif #endif
#include <stddef.h> #include <stddef.h>