diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2007-02-14 16:16:14 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2007-10-11 18:46:15 -0400 |
commit | 9cfde2028bc487982a4bfb0d20d2ca76366fa80d (patch) | |
tree | 3fc934f460b6d036da3005c5514ba5c3b3fb5e93 /include/asm-mips/unaligned.h | |
parent | 21a151d8ca3aa74ee79f9791a9d4dc370d3e0636 (diff) |
[MIPS] Optimize get_unaligned / put_unaligned implementations.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'include/asm-mips/unaligned.h')
-rw-r--r-- | include/asm-mips/unaligned.h | 27 |
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 @@ | |||
3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
4 | * for more details. | 4 | * for more details. |
5 | * | 5 | * |
6 | * Copyright (C) 1996, 1999, 2000, 2001, 2003 by Ralf Baechle | 6 | * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org) |
7 | * Copyright (C) 1999, 2000, 2001 Silicon Graphics, Inc. | ||
8 | */ | 7 | */ |
9 | #ifndef _ASM_UNALIGNED_H | 8 | #ifndef __ASM_GENERIC_UNALIGNED_H |
10 | #define _ASM_UNALIGNED_H | 9 | #define __ASM_GENERIC_UNALIGNED_H |
11 | 10 | ||
12 | #include <asm-generic/unaligned.h> | 11 | #include <linux/compiler.h> |
13 | 12 | ||
14 | #endif /* _ASM_UNALIGNED_H */ | 13 | #define get_unaligned(ptr) \ |
14 | ({ \ | ||
15 | struct __packed { \ | ||
16 | typeof(*(ptr)) __v; \ | ||
17 | } *__p = (void *) (ptr); \ | ||
18 | __p->__v; \ | ||
19 | }) | ||
20 | |||
21 | #define put_unaligned(val, ptr) \ | ||
22 | do { \ | ||
23 | struct __packed { \ | ||
24 | typeof(*(ptr)) __v; \ | ||
25 | } *__p = (void *) (ptr); \ | ||
26 | __p->__v = (val); \ | ||
27 | } while(0) | ||
28 | |||
29 | #endif /* __ASM_GENERIC_UNALIGNED_H */ | ||