diff options
author | Nikias Bassen | 2012-11-20 05:20:11 +0100 |
---|---|---|
committer | Nikias Bassen | 2012-11-20 05:20:11 +0100 |
commit | 4b7a4ff8e5098912ce95fb4ef7264e9fb71c819f (patch) | |
tree | 49604061afb10dff15b05bdd3771574a990bc563 | |
parent | 8173b48515dd830da350eb98f73dde210c5d1be4 (diff) | |
download | libimobiledevice-4b7a4ff8e5098912ce95fb4ef7264e9fb71c819f.tar.gz libimobiledevice-4b7a4ff8e5098912ce95fb4ef7264e9fb71c819f.tar.bz2 |
endianness: define htole32/le32toh for systems lacking it
-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) \ |