]> git.saurik.com Git - redis.git/blob - src/endian.h
ziplist.c fixes for bigendian
[redis.git] / src / endian.h
1 #ifndef __ENDIAN_H
2 #define __ENDIAN_H
3
4 void memrev16(void *p);
5 void memrev32(void *p);
6 void memrev64(void *p);
7
8 /* variants of the function doing the actual convertion only if the target
9 * host is big endian */
10 #if (BYTE_ORDER == LITTLE_ENDIAN)
11 #define memrev16ifbe(p)
12 #define memrev32ifbe(p)
13 #define memrev64ifbe(p)
14 #define intrev16ifbe(v) (v)
15 #define intrev32ifbe(v) (v)
16 #define intrev64ifbe(v) (v)
17 #else
18 #define memrev16ifbe(p) memrev16(p)
19 #define memrev32ifbe(p) memrev32(p)
20 #define memrev64ifbe(p) memrev64(p)
21 #define intrev16ifbe(v) intrev16(v)
22 #define intrev32ifbe(v) intrev32(v)
23 #define intrev64ifbe(v) intrev64(v)
24 #endif
25
26 #endif