1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copied from the kernel sources to tools/perf/:
6 #ifndef __TOOLS_LINUX_ASM_GENERIC_UNALIGNED_H
7 #define __TOOLS_LINUX_ASM_GENERIC_UNALIGNED_H
9 #define __get_unaligned_t(type, ptr) ({ \
10 const struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \
14 #define __put_unaligned_t(type, val, ptr) do { \
15 struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \
19 #define get_unaligned(ptr) __get_unaligned_t(typeof(*(ptr)), (ptr))
20 #define put_unaligned(val, ptr) __put_unaligned_t(typeof(*(ptr)), (val), (ptr))
22 #endif /* __TOOLS_LINUX_ASM_GENERIC_UNALIGNED_H */