Fixed lvlhsh test on 64-bit big-endian systems.

The nxt_murmur_hash2() generated 4-byte hash that was stored in uintptr_t,
which was 8 bytes long on 64-bit systems.  At each iteration, it took the
previous key and hashed it again.

The problem was that it took only the first 4 bytes of the key, and these
4 bytes were always zero on 64-bit big-endian system.  That resulted in
equal keys at each iteration.

The bug was discovered on IBM/S390x.
This commit is contained in:
Valentin Bartenev
2018-11-15 13:00:58 +03:00
parent 08e0082e07
commit b033fb329f

View File

@@ -131,7 +131,7 @@ nxt_int_t
nxt_lvlhsh_test(nxt_thread_t *thr, nxt_uint_t n, nxt_bool_t use_pool)
{
void *value;
uintptr_t key;
uint32_t key;
nxt_mp_t *mp;
nxt_nsec_t start, end;
nxt_uint_t i;