]> git.gag.com Git - fw/sdcc/blobdiff - sdccconf_in.h
* support/regression/generate-cases.py: corrected the file name
[fw/sdcc] / sdccconf_in.h
index 4c6511561bbdf7b49704bcc7e06cbcd900dfd6b5..dc3d30b4a0bc3df9b4059f1defb91b06584b7144 100644 (file)
 #undef TYPE_UWORD
 #undef TYPE_UDWORD
 
+/* find out the endianess of host machine */
+#if __BIG_ENDIAN__ || _BIG_ENDIAN
+/* 1) trust the compiler */
+#define WORDS_BIGENDIAN 1
+#elsif __LITTLE_ENDIAN__
+/* just in case ... */
 #undef WORDS_BIGENDIAN
+#elif (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN)
+/* 2) trust the header files */
+# if BYTE_ORDER == BIG_ENDIAN 
+#   define WORDS_BIGENDIAN 1
+# endif
+#else 
+/* 3) assume that host machine has the same endianess as the build machine */
+# undef BUILD_WORDS_BIGENDIAN
+# if (defined BUILD_WORDS_BIGENDIAN && BUILD_WORDS_BIGENDIAN)
+#   define WORDS_BIGENDIAN  1
+/* 4) assume that host is a little endian machine */
+#endif
 
 #undef OPT_DISABLE_MCS51
 #undef OPT_DISABLE_GBZ80