summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/endianconv.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/endianconv.h b/src/endianconv.h
index 7afe61c62..7c16e175f 100644
--- a/src/endianconv.h
+++ b/src/endianconv.h
@@ -61,4 +61,14 @@ uint64_t intrev64(uint64_t v);
#define intrev64ifbe(v) intrev64(v)
#endif
+/* The functions htonu64() and ntohu64() convert the specified value to
+ * network byte ordering and back. In big endian systems they are no-ops. */
+#if (BYTE_ORDER == BIG_ENDIAN)
+#define htonu64(v) (v)
+#define ntohu64(v) (v)
+#else
+#define htonu64(v) intrev64(v)
+#define ntohu64(v) intrev64(v)
+#endif
+
#endif