On Monday 2009-11-02 07:22, David Miller wrote: >> +static inline uint32_t deref_get_32(const void *ptr) >> +{ >> + uint32_t ret; >> + memcpy(&ret, ptr, sizeof(ret)); >> + return ret; >> +} >> >> Is what I use in one project; however, trying to minimize the >> unalignedness - iptables is a "perfect" example, and netlink >> may do the same tho I am not sure - seems to be the best >> approach in serialized streams. > >This will not work all the time. > >If GCC can see at the inlining point that 'ptr' is of a type that >should be properly aligned it can inline the memcpy and still emit >the very unaligned load or store that you're trying to avoid. Hi Dave, Indeed it seems to be this way. Hm, bad. What codes are you using on your alignment-sensitive SPARCs - the standard bitshifting, "char *p; p[0]<<24 | p[1]<<16 | p[2]<<8 | p[3]"? -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html