diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/compat/endian.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/compat/endian.h b/include/compat/endian.h index 6dfe0b0..ca3465d 100644 --- a/include/compat/endian.h +++ b/include/compat/endian.h | |||
| @@ -62,11 +62,20 @@ | |||
| 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 | #define betoh16(x) ntohs((x)) | 66 | #define betoh16(x) ntohs((x)) |
| 66 | #define htobe16(x) htons((x)) | 67 | #define htobe16(x) htons((x)) |
| 67 | #define betoh32(x) ntohl((x)) | 68 | #define betoh32(x) ntohl((x)) |
| 68 | #define htobe32(x) ntohl((x)) | 69 | #define htobe32(x) ntohl((x)) |
| 69 | #define betoh64(x) ntohll((x)) | 70 | #define betoh64(x) ntohll((x)) |
| 71 | |||
| 72 | #if !defined(ntohll) | ||
| 73 | #define ntohll(x) ((1==htonl(1)) ? (x) : ((uint64_t)ntohl((x) & 0xFFFFFFFF) << 32) | ntohl((x) >> 32)) | ||
| 74 | #endif | ||
| 75 | #if !defined(htonll) | ||
| 76 | #define htonll(x) ((1==ntohl(1)) ? (x) : ((uint64_t)htonl((x) & 0xFFFFFFFF) << 32) | htonl((x) >> 32)) | ||
| 77 | #endif | ||
| 78 | |||
| 70 | #define htobe64(x) ntohll((x)) | 79 | #define htobe64(x) ntohll((x)) |
| 71 | #endif /* _WIN32 && !HAVE_ENDIAN_H */ | 80 | #endif /* _WIN32 && !HAVE_ENDIAN_H */ |
| 72 | 81 | ||
