diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/endianness.h | 12 |
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 @@ #define htobe32 be32toh #endif +#ifndef le32toh +#if __BYTE_ORDER == __BIG_ENDIAN +#define le32toh(x) __bswap_32(x) +#else +#define le32toh(x) (x) +#endif +#endif + +#ifndef htole32 +#define htole32 le32toh +#endif + #ifndef __bswap_64 #define __bswap_64(x) ((((x) & 0xFF00000000000000ull) >> 56) \ | (((x) & 0x00FF000000000000ull) >> 40) \ |