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:
@@ -131,7 +131,7 @@ nxt_int_t
|
|||||||
nxt_lvlhsh_test(nxt_thread_t *thr, nxt_uint_t n, nxt_bool_t use_pool)
|
nxt_lvlhsh_test(nxt_thread_t *thr, nxt_uint_t n, nxt_bool_t use_pool)
|
||||||
{
|
{
|
||||||
void *value;
|
void *value;
|
||||||
uintptr_t key;
|
uint32_t key;
|
||||||
nxt_mp_t *mp;
|
nxt_mp_t *mp;
|
||||||
nxt_nsec_t start, end;
|
nxt_nsec_t start, end;
|
||||||
nxt_uint_t i;
|
nxt_uint_t i;
|
||||||
|
|||||||
Reference in New Issue
Block a user