diff options
| author | Theo Buehler <tb@openbsd.org> | 2023-04-11 16:37:04 +0200 |
|---|---|---|
| committer | Theo Buehler <tb@openbsd.org> | 2023-04-11 17:04:13 +0200 |
| commit | 7f319186539ed6e6cf0e475cf84aef296b30b1a4 (patch) | |
| tree | 8a13bdb0f2f015c05002a7c2287092e6329ac5fc /include | |
| parent | e61927441352a7ac4c51b9b8fc2164d1d236e2f3 (diff) | |
| download | portable-7f319186539ed6e6cf0e475cf84aef296b30b1a4.tar.gz portable-7f319186539ed6e6cf0e475cf84aef296b30b1a4.tar.bz2 portable-7f319186539ed6e6cf0e475cf84aef296b30b1a4.zip | |
attempt to appease mingw32
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 | ||
