summaryrefslogtreecommitdiff
path: root/src/endianconv.h
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2013-09-25 09:26:36 +0200
committerantirez <antirez@gmail.com>2013-09-25 09:26:36 +0200
commitda257afe5777e1bcf3b6b01e2355252be956b511 (patch)
tree7578dae3541d00d97679eec6a76819f832e5262b /src/endianconv.h
parent3c9bb8751a440c9f4bde69ceb54b624f52f589f6 (diff)
downloadredis-da257afe5777e1bcf3b6b01e2355252be956b511.tar.gz
htonu64() and ntohu64 added to endianconv.h.
Diffstat (limited to 'src/endianconv.h')
-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