|
|
@ -13,10 +13,11 @@ |
|
|
|
|
|
|
|
|
|
|
|
#if defined(__FreeBSD__) || defined(__NetBSD__) |
|
|
|
#if defined(__FreeBSD__) || defined(__NetBSD__) |
|
|
|
#include <sys/endian.h> |
|
|
|
#include <sys/endian.h> |
|
|
|
|
|
|
|
|
|
|
|
#elif defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__GLIBC__) |
|
|
|
#elif defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__GLIBC__) |
|
|
|
#include <endian.h> |
|
|
|
#include <endian.h> |
|
|
|
#elif defined(__APPLE__) && defined(__MACH__) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#elif defined(__APPLE__) && defined(__MACH__) |
|
|
|
#include <libkern/OSByteOrder.h> |
|
|
|
#include <libkern/OSByteOrder.h> |
|
|
|
|
|
|
|
|
|
|
|
#define htobe16(x) OSSwapHostToBigInt16(x) |
|
|
|
#define htobe16(x) OSSwapHostToBigInt16(x) |
|
|
@ -34,6 +35,22 @@ |
|
|
|
#define be64toh(x) OSSwapBigToHostInt64(x) |
|
|
|
#define be64toh(x) OSSwapBigToHostInt64(x) |
|
|
|
#define le64toh(x) OSSwapLittleToHostInt64(x) |
|
|
|
#define le64toh(x) OSSwapLittleToHostInt64(x) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#elif defined(_WIN32) |
|
|
|
|
|
|
|
#define htobe16(x) __builtin_bswap16(x) |
|
|
|
|
|
|
|
#define htole16(x) (x) |
|
|
|
|
|
|
|
#define be16toh(x) __builtin_bswap16(x) |
|
|
|
|
|
|
|
#define le16toh(x) (x) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define htobe32(x) __builtin_bswap32(x) |
|
|
|
|
|
|
|
#define htole32(x) (x) |
|
|
|
|
|
|
|
#define be32toh(x) __builtin_bswap32(x) |
|
|
|
|
|
|
|
#define le32toh(x) (x) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define htobe64(x) __builtin_bswap64(x) |
|
|
|
|
|
|
|
#define htole64(x) (x) |
|
|
|
|
|
|
|
#define be64toh(x) __builtin_bswap64(x) |
|
|
|
|
|
|
|
#define le64toh(x) (x) |
|
|
|
|
|
|
|
|
|
|
|
#else |
|
|
|
#else |
|
|
|
#define NEEDS_LOCAL_ENDIAN |
|
|
|
#define NEEDS_LOCAL_ENDIAN |
|
|
|
#include <cstdint> |
|
|
|
#include <cstdint> |
|
|
|