1 #pragma once 2 3 #define __get_unaligned_t(type, ptr) \ 4 ({ \ 5 const struct { \ 6 type x; \ 7 } __packed *__pptr = (typeof(__pptr))(ptr); \ 8 __pptr->x; \ 9 }) 10 11 #define __put_unaligned_t(type, val, ptr) \ 12 do { \ 13 struct { \ 14 type x; \ 15 } __packed *__pptr = (typeof(__pptr))(ptr); \ 16 __pptr->x = (val); \ 17 } while (0) 18