mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-28 02:38:43 +00:00
hashindex: separate endian-dependent defs from endian detection
also make macro style consistent with other macros in the codebase.
This commit is contained in:
parent
90ae9076a4
commit
fafd5e0399
1 changed files with 14 additions and 8 deletions
|
@ -15,17 +15,23 @@
|
||||||
#if (defined(BYTE_ORDER) && (BYTE_ORDER == BIG_ENDIAN)) || \
|
#if (defined(BYTE_ORDER) && (BYTE_ORDER == BIG_ENDIAN)) || \
|
||||||
(defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)) || \
|
(defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)) || \
|
||||||
(defined(_BIG_ENDIAN) && defined(__SVR4)&&defined(__sun))
|
(defined(_BIG_ENDIAN) && defined(__SVR4)&&defined(__sun))
|
||||||
#define _le32toh(x) __builtin_bswap32(x)
|
#define BORG_BIG_ENDIAN 1
|
||||||
#define _htole32(x) __builtin_bswap32(x)
|
|
||||||
#elif (defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN)) || \
|
#elif (defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN)) || \
|
||||||
(defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) || \
|
(defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) || \
|
||||||
(defined(_LITTLE_ENDIAN) && defined(__SVR4)&&defined(__sun))
|
(defined(_LITTLE_ENDIAN) && defined(__SVR4)&&defined(__sun))
|
||||||
#define _le32toh(x) (x)
|
#define BORG_BIG_ENDIAN 0
|
||||||
#define _htole32(x) (x)
|
|
||||||
#else
|
#else
|
||||||
#error Unknown byte order
|
#error Unknown byte order
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if BORG_BIG_ENDIAN
|
||||||
|
#define _le32toh(x) __builtin_bswap32(x)
|
||||||
|
#define _htole32(x) __builtin_bswap32(x)
|
||||||
|
#else
|
||||||
|
#define _le32toh(x) (x)
|
||||||
|
#define _htole32(x) (x)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MAGIC "BORG_IDX"
|
#define MAGIC "BORG_IDX"
|
||||||
#define MAGIC_LEN 8
|
#define MAGIC_LEN 8
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue