murmurhash3 test failures on big-endian systems
Apollon Oikonomopoulos
apoikos at debian.org
Tue Mar 27 13:15:31 EEST 2018
On 13:05 Tue 27 Mar , Apollon Oikonomopoulos wrote:
> On 11:31 Tue 27 Mar , Apollon Oikonomopoulos wrote:
> It turns out there's a missing byte-inversion when loading the blocks
> which should be addressed in getblock{32,64}. Murmurhash treats each
> block as an integer expecting little-endian storage. Applying this
> additional change fixes the build on s390x (and does not break it on
> x864_64):
>
> --- b/src/lib/murmurhash3.c
> +++ b/src/lib/murmurhash3.c
> @@ -23,7 +23,7 @@
>
> static inline uint32_t getblock32(const uint32_t *p, int i)
> {
> - return p[i];
> + return cpu32_to_le(p[i]);
… or perhaps le32_to_cpu, although it should be the same in the end.
> }
>
> //-----------------------------------------------------------------------------
> @@ -105,7 +105,7 @@
>
> static inline uint64_t getblock64(const uint64_t *p, int i)
> {
> - return p[i];
> + return cpu64_to_le(p[i]);
> }
>
> Regards,
> Apollon
More information about the dovecot
mailing list