1 #ifndef __ASM_AVR32_UNALIGNED_H
2 #define __ASM_AVR32_UNALIGNED_H
5 * AVR32 can handle some unaligned accesses, depending on the
6 * implementation. The AVR32 AP implementation can handle unaligned
7 * words, but halfwords must be halfword-aligned, and doublewords must
10 * TODO: Make all this CPU-specific and optimize.
13 #include <linux/string.h>
15 /* Use memmove here, so gcc does not insert a __builtin_memcpy. */
17 #define get_unaligned(ptr) \
18 ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; })
20 #define put_unaligned(val, ptr) \
21 ({ __typeof__(*(ptr)) __tmp = (val); \
22 memmove((ptr), &__tmp, sizeof(*(ptr))); \
25 #endif /* __ASM_AVR32_UNALIGNED_H */