From: Valentin Bartenev Date: Thu, 15 Nov 2018 09:45:02 +0000 (+0300) Subject: Fixed lvlhsh test on 64-bit big-endian systems. X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/postgres_fdw/static/gitweb.js?a=commitdiff_plain;h=2589dcd888deb37b811a6643e4f4a48d4b575296;p=njs.git 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. --- diff --git a/nxt/test/lvlhsh_unit_test.c b/nxt/test/lvlhsh_unit_test.c index 7ed6d6ee..ca750227 100644 --- a/nxt/test/lvlhsh_unit_test.c +++ b/nxt/test/lvlhsh_unit_test.c @@ -196,7 +196,7 @@ static const nxt_mem_proto_t mem_cache_pool_proto = { 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;