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 2d6ad0e..1d414b3 100644
--- a/include/endianness.h
+++ b/include/endianness.h
@@ -31,6 +31,18 @@
31#define htobe16 be16toh 31#define htobe16 be16toh
32#endif 32#endif
33 33
34#ifndef le16toh
35#if __BYTE_ORDER == __BIG_ENDIAN
36#define le16toh(x) ((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8))
37#else
38#define le16toh(x) (x)
39#endif
40#endif
41
42#ifndef htole16
43#define htole16 le16toh
44#endif
45
34#ifndef __bswap_32 46#ifndef __bswap_32
35#define __bswap_32(x) ((((x) & 0xFF000000) >> 24) \ 47#define __bswap_32(x) ((((x) & 0xFF000000) >> 24) \
36 | (((x) & 0x00FF0000) >> 8) \ 48 | (((x) & 0x00FF0000) >> 8) \