0001
0002
0003
0004
0005
0006 #ifndef __TOOLS_LINUX_ASM_GENERIC_UNALIGNED_H
0007 #define __TOOLS_LINUX_ASM_GENERIC_UNALIGNED_H
0008
0009 #define __get_unaligned_t(type, ptr) ({ \
0010 const struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \
0011 __pptr->x; \
0012 })
0013
0014 #define __put_unaligned_t(type, val, ptr) do { \
0015 struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \
0016 __pptr->x = (val); \
0017 } while (0)
0018
0019 #define get_unaligned(ptr) __get_unaligned_t(typeof(*(ptr)), (ptr))
0020 #define put_unaligned(val, ptr) __put_unaligned_t(typeof(*(ptr)), (val), (ptr))
0021
0022 #endif
0023