summaryrefslogtreecommitdiffstats
path: root/include/endianness.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/endianness.h')
-rw-r--r--include/endianness.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/endianness.h b/include/endianness.h
index 1f99fa7..9dfcd0c 100644
--- a/include/endianness.h
+++ b/include/endianness.h
@@ -46,6 +46,18 @@
46#define htobe32 be32toh 46#define htobe32 be32toh
47#endif 47#endif
48 48
49#ifndef le32toh
50#if __BYTE_ORDER == __BIG_ENDIAN
51#define le32toh(x) __bswap_32(x)
52#else
53#define le32toh(x) (x)
54#endif
55#endif
56
57#ifndef htole32
58#define htole32 le32toh
59#endif
60
49#ifndef __bswap_64 61#ifndef __bswap_64
50#define __bswap_64(x) ((((x) & 0xFF00000000000000ull) >> 56) \ 62#define __bswap_64(x) ((((x) & 0xFF00000000000000ull) >> 56) \
51 | (((x) & 0x00FF000000000000ull) >> 40) \ 63 | (((x) & 0x00FF000000000000ull) >> 40) \