New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove unaligned loads and stores on x86 #22
Conversation
Instead of removing the #ifdefs altogether, why not use memcpy there? |
You mean as an optimisation of
|
I mean as a replacement for the current casts, as this would minimize the patch both in lines and in spirit. |
It's not clear whether it will be an optimization. It's possible for the For x86 I think that all major compilers recognize |
Here's a testbed: https://godbolt.org/g/MfP3Hc |
At least for MSVC, removing the special case notably degrades the code. |
I can put in It seems like a pretty safe assumption that |
As tested on godbolt, all x86 compilers (a) benefit significantly from the special case and (b) generate the same code with the current one and with ARM however generates a function call to Looks like the safest choice is to keep the current #ifdefs and just replace the cast inside with |
42026ab
to
791ffad
Compare
…or regardless of the compiler back-end
791ffad
to
d918b6d
Compare
It invokes undefined behavior regardless of the compiler back-end. more details in #21