endian.h: Use POSIX names instead old BSD names
This commit is contained in:
parent
0cb69d68ee
commit
765a8fac94
@ -50,24 +50,24 @@
|
||||
|
||||
#if defined(__APPLE__) && !defined(HAVE_ENDIAN_H)
|
||||
#include <libkern/OSByteOrder.h>
|
||||
#define betoh16(x) OSSwapBigToHostInt16((x))
|
||||
#define be16toh(x) OSSwapBigToHostInt16((x))
|
||||
#define htobe16(x) OSSwapHostToBigInt16((x))
|
||||
#define betoh32(x) OSSwapBigToHostInt32((x))
|
||||
#define be32toh(x) OSSwapBigToHostInt32((x))
|
||||
#define htobe32(x) OSSwapHostToBigInt32(x)
|
||||
#define htole64(x) OSSwapHostToLittleInt64(x)
|
||||
#define htobe64(x) OSSwapHostToBigInt64(x)
|
||||
#define letoh64(x) OSSwapLittleToHostInt64(x)
|
||||
#define betoh64(x) OSSwapBigToHostInt64(x)
|
||||
#define le64toh(x) OSSwapLittleToHostInt64(x)
|
||||
#define be64toh(x) OSSwapBigToHostInt64(x)
|
||||
#endif /* __APPLE__ && !HAVE_ENDIAN_H */
|
||||
|
||||
#if defined(_WIN32) && !defined(HAVE_ENDIAN_H)
|
||||
#include <winsock2.h>
|
||||
|
||||
#define betoh16(x) ntohs((x))
|
||||
#define be16toh(x) ntohs((x))
|
||||
#define htobe16(x) htons((x))
|
||||
#define betoh32(x) ntohl((x))
|
||||
#define be32toh(x) ntohl((x))
|
||||
#define htobe32(x) ntohl((x))
|
||||
#define betoh64(x) ntohll((x))
|
||||
#define be64toh(x) ntohll((x))
|
||||
|
||||
#if !defined(ntohll)
|
||||
#define ntohll(x) ((1==htonl(1)) ? (x) : ((uint64_t)ntohl((x) & 0xFFFFFFFF) << 32) | ntohl((x) >> 32))
|
||||
|
Loading…
x
Reference in New Issue
Block a user