1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only */ 2 #if defined(__FreeBSD__) 3 #include <sys/endian.h> 4 #elif defined(__APPLE__) 5 #include <libkern/OSByteOrder.h> 6 7 #define htobe16(x) OSSwapHostToBigInt16(x) 8 #define htole16(x) OSSwapHostToLittleInt16(x) 9 #define be16toh(x) OSSwapBigToHostInt16(x) 10 #define le16toh(x) OSSwapLittleToHostInt16(x) 11 12 #define htobe32(x) OSSwapHostToBigInt32(x) 13 #define htole32(x) OSSwapHostToLittleInt32(x) 14 #define be32toh(x) OSSwapBigToHostInt32(x) 15 #define le32toh(x) OSSwapLittleToHostInt32(x) 16 17 #define htobe64(x) OSSwapHostToBigInt64(x) 18 #define htole64(x) OSSwapHostToLittleInt64(x) 19 #define be64toh(x) OSSwapBigToHostInt64(x) 20 #define le64toh(x) OSSwapLittleToHostInt64(x) 21 #else 22 #include <endian.h> 23 #endif 24