diff options
author | Satadru Pramanik <satadru@umich.edu> | 2022-06-21 20:44:30 +0000 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-06-21 20:44:30 +0000 |
commit | 1fa5d4bdfcc6fea44f9abf353d25f3a5d013f5d7 (patch) | |
tree | 4482f58270dc8381c0bc36cc004af8e39014eb48 | |
parent | 22a93f8b9b4a79eefbdd0b2c412526f6141ac7a8 (diff) | |
download | libpciaccess-1fa5d4bdfcc6fea44f9abf353d25f3a5d013f5d7.tar.gz |
Add support for building on macOS w/o X11, using endian code from "portable_endian.h"...
-rw-r--r-- | src/common_interface.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/common_interface.c b/src/common_interface.c index cb95e90..a4439b6 100644 --- a/src/common_interface.c +++ b/src/common_interface.c @@ -70,6 +70,24 @@ # define HTOLE_32(x) (x) #endif /* Solaris */ +#elif defined(__APPLE__) +#include <libkern/OSByteOrder.h> + +#define htobe16(x) OSSwapHostToBigInt16(x) +#define htole16(x) OSSwapHostToLittleInt16(x) +#define be16toh(x) OSSwapBigToHostInt16(x) +#define le16toh(x) OSSwapLittleToHostInt16(x) + +#define htobe32(x) OSSwapHostToBigInt32(x) +#define htole32(x) OSSwapHostToLittleInt32(x) +#define be32toh(x) OSSwapBigToHostInt32(x) +#define le32toh(x) OSSwapLittleToHostInt32(x) + +#define htobe64(x) OSSwapHostToBigInt64(x) +#define htole64(x) OSSwapHostToLittleInt64(x) +#define be64toh(x) OSSwapBigToHostInt64(x) +#define le64toh(x) OSSwapLittleToHostInt64(x) + #else #include <sys/endian.h> |