summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-05-30 23:12:30 +0100
committerDamien George <damien.p.george@gmail.com>2015-05-30 23:12:30 +0100
commit4e4772bb5b9e96df7e2c53c7a05efa9b51beeee1 (patch)
tree1fe3ae7660ef650b0eb777468d2197d77eaba1d9
parent26b512ea1bcc8035f8f5312b2065c85a639c02ae (diff)
downloadmicropython-4e4772bb5b9e96df7e2c53c7a05efa9b51beeee1.tar.gz
micropython-4e4772bb5b9e96df7e2c53c7a05efa9b51beeee1.zip
py: Add further autodetection of endianess in mpconfig.h.
This patch was needed for gcc 4.4.
-rw-r--r--py/mpconfig.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h
index 5065e36828..2d9288f32b 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -711,7 +711,16 @@ typedef double mp_float_t;
#elif defined(__BIG_ENDIAN__) || defined(__BIG_ENDIAN) || defined (_BIG_ENDIAN)
#define MP_ENDIANNESS_LITTLE (0)
#else
- #error endianness not defined and cannot detect it
+ #include <endian.h>
+ #if defined(__BYTE_ORDER)
+ #if __BYTE_ORDER == __LITTLE_ENDIAN
+ #define MP_ENDIANNESS_LITTLE (1)
+ #else
+ #define MP_ENDIANNESS_LITTLE (0)
+ #endif
+ #else
+ #error endianness not defined and cannot detect it
+ #endif
#endif
#define MP_ENDIANNESS_BIG (!MP_ENDIANNESS_LITTLE)
#endif