Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _ASM_M32R_UNALIGNED_H |
| 2 | #define _ASM_M32R_UNALIGNED_H |
| 3 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | /* |
| 5 | * For the benefit of those who are trying to port Linux to another |
| 6 | * architecture, here are some C-language equivalents. |
| 7 | */ |
| 8 | |
| 9 | #include <asm/string.h> |
| 10 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | #define get_unaligned(ptr) \ |
| 12 | ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; }) |
| 13 | |
| 14 | #define put_unaligned(val, ptr) \ |
| 15 | ({ __typeof__(*(ptr)) __tmp = (val); \ |
| 16 | memmove((ptr), &__tmp, sizeof(*(ptr))); \ |
| 17 | (void)0; }) |
| 18 | |
Hirokazu Takata | fabb626 | 2007-02-10 01:43:40 -0800 | [diff] [blame] | 19 | #endif /* _ASM_M32R_UNALIGNED_H */ |