Le mercredi 17 novembre 2010 à 21:47 +0200, Sergey A. Borshch a écrit :
> __attribute__((packed))
> That's all you need.

Thanks, it seems to work (both comparisons aren't merged anymore).

But I'm really wondering: why does this work? The struct only contains
one byte members, so it is packed, and if it weren't, gcc wouldn't be
able to compare both values at the same time using a word.

And I also don't get why setting the struct as packed disables the
optimization, as it has no effect on how the struct is arranged in
memory in this case…


Best regards,
Alex


------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to