Closed xen2 closed 8 years ago
I tested it only with MSVC and EMCC (Emscripten) which is using Clang; I am almost sure GCC is fine with it but didn't check it.
Note: there are probably many other cases like this to fix, just fixed a few so that I could read a .ARW without problem. I should find many more while testing more files in the next weeks.
Also, for now I take worst-case alignment to 1, but 2 bytes might be enough.
Some of the bitpumps uses this to access 32 bits at the time instead of 8.
Just out of curiosity. What platform are you experiencing problems on?
Emscripten (javascript) don't like it, and ARM would crash as well. Generally it is undefined behavior, but it happens to work on x86 (however, even on x86 it is a slow path when unaligned).
Just realized that after rebasing on latest version, as you said, changes in BitPumpPlain.cpp are needed. I will submit additional patches soon.
I didn't know that trick. Do you know if it works on all both GCC and MSVC?