[njs] Fixed lvlhsh test on 64-bit big-endian systems.
Valentin Bartenev
vbart at nginx.com
Thu Nov 15 11:57:21 UTC 2018
details: http://hg.nginx.org/njs/rev/7f0f7d149709
branches:
changeset: 652:7f0f7d149709
user: Valentin Bartenev <vbart at nginx.com>
date: Thu Nov 15 12:45:02 2018 +0300
description:
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:
nxt/test/lvlhsh_unit_test.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diffs (12 lines):
diff -r 52e540f16740 -r 7f0f7d149709 nxt/test/lvlhsh_unit_test.c
--- a/nxt/test/lvlhsh_unit_test.c Tue Nov 13 15:25:00 2018 +0300
+++ b/nxt/test/lvlhsh_unit_test.c Thu Nov 15 12:45:02 2018 +0300
@@ -196,7 +196,7 @@ static const nxt_mem_proto_t mem_cache_
static nxt_int_t
lvlhsh_unit_test(nxt_uint_t n)
{
- uintptr_t key;
+ uint32_t key;
nxt_uint_t i;
nxt_lvlhsh_t lh;
nxt_lvlhsh_each_t lhe;
More information about the nginx-devel
mailing list