Import 2.3.1
[davej-history.git] / include / asm-generic / unaligned.h
blob57b14024ca579abcb2add8a66e2cbfabaefa8028
1 #ifndef _ASM_GENERIC_UNALIGNED_H_
2 #define _ASM_GENERIC_UNALIGNED_H_
4 /*
5 * For the benefit of those who are trying to port Linux to another
6 * architecture, here are some C-language equivalents.
7 */
9 #include <asm/string.h>
12 #define get_unaligned(ptr) \
13 ({ __typeof__(*(ptr)) __tmp; memcpy(&__tmp, (ptr), sizeof(*(ptr))); __tmp; })
15 #define put_unaligned(val, ptr) \
16 ({ __typeof__(*(ptr)) __tmp = (val); \
17 memcpy((ptr), &__tmp, sizeof(*(ptr))); \
18 (void)0; })
20 #endif /* _ASM_GENERIC_UNALIGNED_H */