On Sat, 23 Feb 2019 at 16:05, Natanael Copa <nc...@alpinelinux.org> wrote: > I was thinking of something in the lines of: > > typedef volatile uint16_t __attribute__((__may_alias__)) volatile_uint16_t; > static inline int lduw_he_p(const void *ptr) > { > volatile_uint16_t r = *(volatile_uint16_t*)ptr; > return r; > }
This won't correctly handle accesses with unaligned pointers, I'm afraid. We rely on these functions correctly working with pointers that are potentially unaligned. thanks -- PMM