summaryrefslogtreecommitdiffstats
path: root/include/asm-mips/unaligned.h
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2007-02-14 22:16:14 +0100
committerRalf Baechle <ralf@linux-mips.org>2007-10-12 00:46:15 +0200
commit9cfde2028bc487982a4bfb0d20d2ca76366fa80d (patch)
tree3fc934f460b6d036da3005c5514ba5c3b3fb5e93 /include/asm-mips/unaligned.h
parent[MIPS] checkfiles: Fix "need space after that ','" errors. (diff)
downloadlinux-9cfde2028bc487982a4bfb0d20d2ca76366fa80d.tar.xz
linux-9cfde2028bc487982a4bfb0d20d2ca76366fa80d.zip
[MIPS] Optimize get_unaligned / put_unaligned implementations.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to '')
-rw-r--r--include/asm-mips/unaligned.h27
1 files changed, 21 insertions, 6 deletions
diff --git a/include/asm-mips/unaligned.h b/include/asm-mips/unaligned.h
index a0042563838a..3249049e93aa 100644
--- a/include/asm-mips/unaligned.h
+++ b/include/asm-mips/unaligned.h
@@ -3,12 +3,27 @@
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
- * Copyright (C) 1996, 1999, 2000, 2001, 2003 by Ralf Baechle
- * Copyright (C) 1999, 2000, 2001 Silicon Graphics, Inc.
+ * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
*/
-#ifndef _ASM_UNALIGNED_H
-#define _ASM_UNALIGNED_H
+#ifndef __ASM_GENERIC_UNALIGNED_H
+#define __ASM_GENERIC_UNALIGNED_H
-#include <asm-generic/unaligned.h>
+#include <linux/compiler.h>
-#endif /* _ASM_UNALIGNED_H */
+#define get_unaligned(ptr) \
+({ \
+ struct __packed { \
+ typeof(*(ptr)) __v; \
+ } *__p = (void *) (ptr); \
+ __p->__v; \
+})
+
+#define put_unaligned(val, ptr) \
+do { \
+ struct __packed { \
+ typeof(*(ptr)) __v; \
+ } *__p = (void *) (ptr); \
+ __p->__v = (val); \
+} while(0)
+
+#endif /* __ASM_GENERIC_UNALIGNED_H */