summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2008-10-30 03:31:33 +0000
committermarcel <marcel@FreeBSD.org>2008-10-30 03:31:33 +0000
commit64f5c798060141caed6af88363eae68a07fe383d (patch)
treed191622cb388afbffe8ed5c3b8a7c432ffed31bb /sys/powerpc
parent5256ae4dbd8b07789124a677fff88bf45368171e (diff)
downloadFreeBSD-src-64f5c798060141caed6af88363eae68a07fe383d.zip
FreeBSD-src-64f5c798060141caed6af88363eae68a07fe383d.tar.gz
Add support for little-endian compilations to this file.
Diffstat (limited to 'sys/powerpc')
-rw-r--r--sys/powerpc/include/endian.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/powerpc/include/endian.h b/sys/powerpc/include/endian.h
index bc96b9e..176c710 100644
--- a/sys/powerpc/include/endian.h
+++ b/sys/powerpc/include/endian.h
@@ -44,15 +44,29 @@
#define _QUAD_LOWWORD 1
/*
+ * GCC defines _BIG_ENDIAN and _LITTLE_ENDIAN equal to __BIG_ENDIAN__
+ * and __LITTLE_ENDIAN__ (resp).
+ */
+#ifdef _BIG_ENDIAN
+#undef _BIG_ENDIAN
+#endif
+#ifdef _LITTLE_ENDIAN
+#undef _LITTLE_ENDIAN
+#endif
+
+/*
* Definitions for byte order, according to byte significance from low
* address to high.
*/
-#undef _BIG_ENDIAN /* GCC annoyingly defines this for PowerPC */
#define _LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
#define _BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
#define _PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
+#ifdef __LITTLE_ENDIAN__
+#define _BYTE_ORDER _LITTLE_ENDIAN
+#else
#define _BYTE_ORDER _BIG_ENDIAN
+#endif
/*
* Deprecated variants that don't have enough underscores to be useful in more
OpenPOWER on IntegriCloud