Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[linux-2.6] / include / asm-mips / unaligned.h
1 /*
2  * This file is subject to the terms and conditions of the GNU General Public
3  * License.  See the file "COPYING" in the main directory of this archive
4  * for more details.
5  *
6  * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
7  */
8 #ifndef __ASM_GENERIC_UNALIGNED_H
9 #define __ASM_GENERIC_UNALIGNED_H
10
11 #include <linux/compiler.h>
12
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 */