summaryrefslogtreecommitdiffstats
path: root/libc/arch-sh/include/endian.h
diff options
context:
space:
mode:
authorShin-ichiro KAWASAKI <shinichiro.kawasaki.mg@hitachi.com>2009-09-28 16:11:39 +0900
committerTony Sim <sim.chinyeow@renesas.com>2009-09-28 16:11:39 +0900
commit10093276e98d26428875480c502a278dffe550c7 (patch)
tree82b93376f21744cb1696a27c084d633d162a6ab1 /libc/arch-sh/include/endian.h
parent4e30c09e57a0351daff70f6657794569445be21c (diff)
downloadbionic-10093276e98d26428875480c502a278dffe550c7.zip
bionic-10093276e98d26428875480c502a278dffe550c7.tar.gz
bionic-10093276e98d26428875480c502a278dffe550c7.tar.bz2
added and modified bionic code to support SuperH architecture
modified: libc/Android.mk new files: libc/arch-sh/bionic/* new files: libc/arch-sh/include/*
Diffstat (limited to 'libc/arch-sh/include/endian.h')
-rw-r--r--libc/arch-sh/include/endian.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/libc/arch-sh/include/endian.h b/libc/arch-sh/include/endian.h
new file mode 100644
index 0000000..ad10164
--- /dev/null
+++ b/libc/arch-sh/include/endian.h
@@ -0,0 +1,39 @@
+/* $OpenBSD: endian.h,v 1.1.1.1 2006/10/06 21:02:55 miod Exp $ */
+/* $NetBSD: endian.h,v 1.4 2000/03/17 00:09:25 mycroft Exp $ */
+
+/* Written by Manuel Bouyer. Public domain */
+
+#ifndef _SH_ENDIAN_H_
+#define _SH_ENDIAN_H_
+
+#ifdef __GNUC__
+
+#define __swap64md __swap64gen
+
+#define __swap16md(x) ({ \
+ uint16_t rval; \
+ \
+ __asm volatile ("swap.b %1,%0" : "=r"(rval) : "r"(x)); \
+ \
+ rval; \
+})
+
+#define __swap32md(x) ({ \
+ uint32_t rval; \
+ \
+ __asm volatile ("swap.b %1,%0; swap.w %0,%0; swap.b %0,%0" \
+ : "=r"(rval) : "r"(x)); \
+ \
+ rval; \
+})
+
+#define MD_SWAP
+
+#endif /* __GNUC_ */
+
+#define _BYTE_ORDER _LITTLE_ENDIAN
+#include <sys/endian.h>
+
+#define __STRICT_ALIGNMENT
+
+#endif /* !_SH_ENDIAN_H_ */