summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2012-11-20 05:20:11 +0100
committerGravatar Nikias Bassen2012-11-20 05:20:11 +0100
commit4b7a4ff8e5098912ce95fb4ef7264e9fb71c819f (patch)
tree49604061afb10dff15b05bdd3771574a990bc563
parent8173b48515dd830da350eb98f73dde210c5d1be4 (diff)
downloadlibimobiledevice-4b7a4ff8e5098912ce95fb4ef7264e9fb71c819f.tar.gz
libimobiledevice-4b7a4ff8e5098912ce95fb4ef7264e9fb71c819f.tar.bz2
endianness: define htole32/le32toh for systems lacking it
-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 @@
#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) \