summaryrefslogtreecommitdiffhomepage
path: root/src/test/nxt_lvlhsh_test.c
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2018-11-15 13:00:58 +0300
committerValentin Bartenev <vbart@nginx.com>2018-11-15 13:00:58 +0300
commitb033fb329fc14e6469596821508c487e3ed6ff82 (patch)
tree5115dc2793f1bf771306ea273e056534d90ffbe2 /src/test/nxt_lvlhsh_test.c
parent08e0082e070354919de9584a8d26436a1dadeac0 (diff)
downloadunit-b033fb329fc14e6469596821508c487e3ed6ff82.tar.gz
unit-b033fb329fc14e6469596821508c487e3ed6ff82.tar.bz2
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.
Diffstat (limited to 'src/test/nxt_lvlhsh_test.c')
-rw-r--r--src/test/nxt_lvlhsh_test.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test/nxt_lvlhsh_test.c b/src/test/nxt_lvlhsh_test.c
index 3dc56076..2e1e0b20 100644
--- a/src/test/nxt_lvlhsh_test.c
+++ b/src/test/nxt_lvlhsh_test.c
@@ -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;