ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-m68knommu / unaligned.h
1 #ifndef __M68K_UNALIGNED_H
2 #define __M68K_UNALIGNED_H
3
4 #include <linux/config.h>
5
6 #ifdef CONFIG_COLDFIRE
7
8 /* Use memmove here, so gcc does not insert a __builtin_memcpy. */
9
10 #define get_unaligned(ptr) \
11   ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; })
12
13 #define put_unaligned(val, ptr)                         \
14   ({ __typeof__(*(ptr)) __tmp = (val);                  \
15      memmove((ptr), &__tmp, sizeof(*(ptr)));            \
16      (void)0; })
17
18 #else
19 /*
20  * The m68k can do unaligned accesses itself. 
21  *
22  * The strange macros are there to make sure these can't
23  * be misused in a way that makes them not work on other
24  * architectures where unaligned accesses aren't as simple.
25  */
26
27 #define get_unaligned(ptr) (*(ptr))
28 #define put_unaligned(val, ptr) ((void)( *(ptr) = (val) ))
29
30 #endif
31
32 #endif