Follow-up Comment #2, patch #1158 (project wesnoth):
The point of the (aligned(4)) and (packed) attributes is to try to break
aliasing rules and get away with it, but you're right; I hadn't thought about
what happens when it's inlined.
I like your idea of ((y << 16) | x); I looked at the generated ASM for that
and it's just as long as what's there currently, but I'm about to test it and
I think it'll be faster because there are no branches to mispredict.
Assuming my expectation is correct, this can be used for the general case and
maybe all cases. For gcc on x86/x86_64, I'm going to try some hand-written
assembly. This will make it impossible for gcc to inline the method, but
that should be okay because it can rarely if ever be used inline anyhow; it
usually gets called from STL.
_______________________________________________________
Reply to this item at:
<http://gna.org/patch/?1158>
_______________________________________________
Message sent via/by Gna!
http://gna.org/
_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs