aklomp / base64

Fast Base64 stream encoder/decoder in C99, with SIMD acceleration
BSD 2-Clause "Simplified" License
866 stars 162 forks source link

_MSC_VER's #define BASE64_HTOBE64 codepath in env.h should #include <intrin.h> #68

Closed mgambrell closed 4 years ago

mgambrell commented 4 years ago

without #include <intrin.h>, _byteswap_uint64 is undefined at point of use and assumed due to C sucking to be returning an int.. an int that's 32bits. this makes the result be garbled (for future searchers, it makes it 32bits sign extended into src).

aklomp commented 4 years ago

Thanks for the report. Good catch, what a crappy bug. Unfortunately the CI doesn't build the library for Windows yet due to missing Cmake support, or this would have been caught by the automated tests. I pushed an issue68 branch, can you confirm that it fixes the bug?

mgambrell commented 4 years ago

works for me, looks sensible by inspection.

aklomp commented 4 years ago

Thanks, merged.