diff options
author | Theo Buehler <tb@openbsd.org> | 2023-05-17 16:49:25 +0200 |
---|---|---|
committer | Theo Buehler <tb@openbsd.org> | 2023-05-17 16:49:25 +0200 |
commit | 765a8fac94fece34cead0bd03f89bdb1b8c43da6 (patch) | |
tree | c8b4f0f34a2ce6ab3cb63ee17fe6af531e7266bc | |
parent | 0cb69d68ee84987861f99a7ad7d0bb018ebc0002 (diff) | |
download | portable-765a8fac94fece34cead0bd03f89bdb1b8c43da6.tar.gz portable-765a8fac94fece34cead0bd03f89bdb1b8c43da6.tar.bz2 portable-765a8fac94fece34cead0bd03f89bdb1b8c43da6.zip |
endian.h: Use POSIX names instead old BSD names
-rw-r--r-- | include/compat/endian.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/include/compat/endian.h b/include/compat/endian.h index ca3465d..d9f7eb2 100644 --- a/include/compat/endian.h +++ b/include/compat/endian.h | |||
@@ -50,24 +50,24 @@ | |||
50 | 50 | ||
51 | #if defined(__APPLE__) && !defined(HAVE_ENDIAN_H) | 51 | #if defined(__APPLE__) && !defined(HAVE_ENDIAN_H) |
52 | #include <libkern/OSByteOrder.h> | 52 | #include <libkern/OSByteOrder.h> |
53 | #define betoh16(x) OSSwapBigToHostInt16((x)) | 53 | #define be16toh(x) OSSwapBigToHostInt16((x)) |
54 | #define htobe16(x) OSSwapHostToBigInt16((x)) | 54 | #define htobe16(x) OSSwapHostToBigInt16((x)) |
55 | #define betoh32(x) OSSwapBigToHostInt32((x)) | 55 | #define be32toh(x) OSSwapBigToHostInt32((x)) |
56 | #define htobe32(x) OSSwapHostToBigInt32(x) | 56 | #define htobe32(x) OSSwapHostToBigInt32(x) |
57 | #define htole64(x) OSSwapHostToLittleInt64(x) | 57 | #define htole64(x) OSSwapHostToLittleInt64(x) |
58 | #define htobe64(x) OSSwapHostToBigInt64(x) | 58 | #define htobe64(x) OSSwapHostToBigInt64(x) |
59 | #define letoh64(x) OSSwapLittleToHostInt64(x) | 59 | #define le64toh(x) OSSwapLittleToHostInt64(x) |
60 | #define betoh64(x) OSSwapBigToHostInt64(x) | 60 | #define be64toh(x) OSSwapBigToHostInt64(x) |
61 | #endif /* __APPLE__ && !HAVE_ENDIAN_H */ | 61 | #endif /* __APPLE__ && !HAVE_ENDIAN_H */ |
62 | 62 | ||
63 | #if defined(_WIN32) && !defined(HAVE_ENDIAN_H) | 63 | #if defined(_WIN32) && !defined(HAVE_ENDIAN_H) |
64 | #include <winsock2.h> | 64 | #include <winsock2.h> |
65 | 65 | ||
66 | #define betoh16(x) ntohs((x)) | 66 | #define be16toh(x) ntohs((x)) |
67 | #define htobe16(x) htons((x)) | 67 | #define htobe16(x) htons((x)) |
68 | #define betoh32(x) ntohl((x)) | 68 | #define be32toh(x) ntohl((x)) |
69 | #define htobe32(x) ntohl((x)) | 69 | #define htobe32(x) ntohl((x)) |
70 | #define betoh64(x) ntohll((x)) | 70 | #define be64toh(x) ntohll((x)) |
71 | 71 | ||
72 | #if !defined(ntohll) | 72 | #if !defined(ntohll) |
73 | #define ntohll(x) ((1==htonl(1)) ? (x) : ((uint64_t)ntohl((x) & 0xFFFFFFFF) << 32) | ntohl((x) >> 32)) | 73 | #define ntohll(x) ((1==htonl(1)) ? (x) : ((uint64_t)ntohl((x) & 0xFFFFFFFF) << 32) | ntohl((x) >> 32)) |