mirror of
https://github.com/fluencelabs/redis
synced 2025-06-13 01:01:22 +00:00
encoding.c/h added, this new functions make sure that even our in memory represenation of encoded types is endianess agnostic, so we can save this stuff directly on disk without problems when reloading on a different arch.
This commit is contained in:
20
src/endian.h
Normal file
20
src/endian.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef __ENDIAN_H
|
||||
#define __ENDIAN_H
|
||||
|
||||
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
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user