Commit | Line | Data |
---|---|---|
1da177e4 LT |
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 | * | |
9cfde202 | 6 | * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org) |
1da177e4 | 7 | */ |
9cfde202 RB |
8 | #ifndef __ASM_GENERIC_UNALIGNED_H |
9 | #define __ASM_GENERIC_UNALIGNED_H | |
1da177e4 | 10 | |
9cfde202 | 11 | #include <linux/compiler.h> |
1da177e4 | 12 | |
9cfde202 RB |
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 */ |