[PATCH] Use sys/param.h as an endianness fallback in compiler-rt

Taral taralx at gmail.com
Mon Jun 9 14:36:53 PDT 2014


Trying again with a PATCH subject line.


---------- Forwarded message ----------
From: Taral <taralx at gmail.com>
Date: Thu, Jun 5, 2014 at 4:30 PM
Subject: Proposed patch for #19959
To: llvm-commits at cs.uiuc.edu


http://llvm.org/bugs/show_bug.cgi?id=19959

Patch is also attached here. Thoughts?

--
Taral <taralx at gmail.com>
"Please let me know if there's any further trouble I can give you."
    -- Unknown
-------------- next part --------------
--- a/lib/builtins/int_endianness.h
+++ b/lib/builtins/int_endianness.h
@@ -102,6 +102,23 @@

 #endif /* Windows */

+/* .. */
+
+#if !defined(_YUGA_LITTLE_ENDIAN) || !defined(_YUGA_BIG_ENDIAN)
+#include <sys/param.h>
+
+#if defined(BYTE_ORDER) && defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN)
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define _YUGA_LITTLE_ENDIAN 1
+#define _YUGA_BIG_ENDIAN 0
+#elif BYTE_ORDER == BIG_ENDIAN
+#define _YUGA_LITTLE_ENDIAN 0
+#define _YUGA_BIG_ENDIAN 1
+#endif /* BYTE_ORDER */
+#endif /* generic sys/param.h */
+
+#endif /* fallback */
+
 /* . */

 #if !defined(_YUGA_LITTLE_ENDIAN) || !defined(_YUGA_BIG_ENDIAN)


More information about the llvm-commits mailing list