Permalink
Browse files

2005-06-16 Al Riddoch <alriddoch@zepler.org>

	* libmd3/inttypes.h: Add in endian check, in readiness for
	  making the loader endian independant.
  • Loading branch information...
1 parent 7dd2fb2 commit a229432f06dbe94a6a6609413030842a4c39b004 @alriddoch committed Jun 16, 2005
Showing with 34 additions and 0 deletions.
  1. +5 −0 ChangeLog
  2. +29 −0 libmd3/inttypes.h
View
@@ -1,3 +1,8 @@
+2005-06-16 Al Riddoch <alriddoch@zepler.org>
+
+ * libmd3/inttypes.h: Add in endian check, in readiness for
+ making the loader endian independant.
+
2005-06-16 Al Riddoch <alriddoch@zepler.org>
* libmd3/loader.c: Fix some error conditions which were not
View
@@ -19,6 +19,35 @@
#ifndef LIBMD3_INTTYPES_H
#define LIBMD3_INTTYPES_H
+/* PDP_ENDIAN is ignored, as its unlikely that this code will be used
+ * on such a systems */
+#define LIBMD3_LITTLE_ENDIAN 1234
+#define LIBMD3_BIG_ENDIAN 4321
+
+#ifdef __linux__
+
+ #include <endian.h>
+
+ #define LIBMD3_BYTE_ORDER __BYTE_ORDER
+
+#else
+
+/* Check for any OSs or architectures which are known to be little endian */
+#if defined(__LITTLE_ENDIAN__) || defined(WIN32) || defined(__SYMBIAN32__) || \
+ defined(__i386__) || defined(__ia64__) || defined(__alpha__) || \
+ defined(__alpha) || defined(__arm__) || defined(__x86_64__) || \
+ (defined(__mips__) && defined(__MIPSEL__))
+
+ #define LIBMD3_BYTE_ORDER LIBMD3_LITTLE_ENDIAN
+
+#else
+
+ #define LIBMD3_BYTE_ORDER LIBMD3_BIG_ENDIAN
+
+#endif
+
+#endif /* __linux __ */
+
#if defined(_MSC_VER)
typedef signed int int32_t;

0 comments on commit a229432

Please sign in to comment.