aboutsummaryrefslogtreecommitdiff
path: root/src/include/ndpi_define.h.in
diff options
context:
space:
mode:
authorIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2021-09-23 13:24:49 +0200
committerGitHub <noreply@github.com>2021-09-23 13:24:49 +0200
commit7eb73bc92abebe60dde5626673b342a3d9601eb2 (patch)
tree22ed2de3f9998eb19ffd411128089f1accb7496a /src/include/ndpi_define.h.in
parent0994771974d686aa5395c5ba0fe71acef0d62e9d (diff)
QUIC: fix old GQUIC versions on big-endian machines (#1313)
Diffstat (limited to 'src/include/ndpi_define.h.in')
-rw-r--r--src/include/ndpi_define.h.in40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/include/ndpi_define.h.in b/src/include/ndpi_define.h.in
index e959b23a9..150b04940 100644
--- a/src/include/ndpi_define.h.in
+++ b/src/include/ndpi_define.h.in
@@ -385,6 +385,46 @@
#endif /* __APPLE__ */
+
+#if defined(__MINGW32__)
+
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+
+#define htobe16(x) htons(x)
+#define htole16(x) (x)
+#define be16toh(x) ntohs(x)
+#define le16toh(x) (x)
+#define htobe32(x) htonl(x)
+#define htole32(x) (x)
+#define be32toh(x) ntohl(x)
+#define le32toh(x) (x)
+#define htobe64(x) htonll(x)
+#define htole64(x) (x)
+#define be64toh(x) ntohll(x)
+#define le64toh(x) (x)
+
+#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+
+#define htobe16(x) (x)
+#define htole16(x) __builtin_bswap16(x)
+#define be16toh(x) (x)
+#define le16toh(x) __builtin_bswap16(x)
+#define htobe32(x) (x)
+#define htole32(x) __builtin_bswap32(x)
+#define be32toh(x) (x)
+#define le32toh(x) __builtin_bswap32(x)
+#define htobe64(x) (x)
+#define htole64(x) __builtin_bswap64(x)
+#define be64toh(x) (x)
+#define le64toh(x) __builtin_bswap64(x)
+
+#else
+#error Unexpected __BYTE_ORDER__
+
+#endif /* __BYTE_ORDER__ */
+#endif /* __MINGW32__ */
+
+
#ifndef ETH_ARP
#define ETH_ARP 0x0806
#endif