Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix endianism issues that were causing snappy to compress incorrectly (…
…#1219, @rthalley) on Solaris SPARC The two key things are: 1) getting __LITTLE_ENDIAN, __BIG_ENDIAN, and __BYTE_ORDER defined properly 2) the (uint16_t) part of the #define htole16(x) ((uint16_t)BSWAP_16(x)) line. The cast is essential as otherwise in this part of a macro in snappy_compat.h typeof((v)) _v = (v); \ memcpy((x), &_v, sizeof(*(x))); }) the value of 'v' has typeof int, not uint16_t, and it takes the 32-bit extended value and copies the first two bytes, which being big endian, are zero and not the correct swapped value.
- Loading branch information