]> git.kaiwu.me - njs.git/commit
Fixed lvlhsh test on 64-bit big-endian systems.
authorValentin Bartenev <vbart@nginx.com>
Thu, 15 Nov 2018 09:45:02 +0000 (12:45 +0300)
committerValentin Bartenev <vbart@nginx.com>
Thu, 15 Nov 2018 09:45:02 +0000 (12:45 +0300)
commit2589dcd888deb37b811a6643e4f4a48d4b575296
tree96c0a5ab55c11479610f61ae10ffe3d0d37b0d78
parent095766ddb25258624914465f58e4453d2e5fe6d9
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.
nxt/test/lvlhsh_unit_test.c