summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2011-03-09 17:28:16 +0100
committerantirez <antirez@gmail.com>2011-03-09 17:28:16 +0100
commitb5325132f1c8bc90e6c87392c54724ca33388ee8 (patch)
tree48756a310d64a85e5230b163c07dff0a7e8645cd /src
parentbcde63785d6c6e54ae71216df8bec276f2c85155 (diff)
downloadredis-b5325132f1c8bc90e6c87392c54724ca33388ee8.tar.gz
memrev variants only doing the work if the target host is big endian
Diffstat (limited to 'src')
-rw-r--r--src/endian.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/endian.h b/src/endian.h
index ea295ee5f..327cc570d 100644
--- a/src/endian.h
+++ b/src/endian.h
@@ -5,4 +5,14 @@ void memrev16(void *p);
void memrev32(void *p);
void memrev64(void *p);
+/* variants of the function doing the actual convertion only if the target
+ * host is big endian */
+#if (BYTE_ORDER == LITTLE_ENDIAN)
+#define memrev16ifbe(p)
+#define memrev32ifbe(p)
+#define memrev64ifbe(p)
+#else
+#define memrev16ifbe(p) memrev16(p)
+#define memrev32ifbe(p) memrev32(p)
+#define memrev64ifbe(p) memrev64(p)
#endif