From: funny.falcon@... Date: 2016-12-10T22:18:30+00:00 Subject: [ruby-core:78587] [Ruby trunk Bug#13019] Fix st_hash* functions Issue #13019 has been updated by Yura Sokolov. It passes SMHasher (at least, little-endian variant). ---------------------------------------- Bug #13019: Fix st_hash* functions https://bugs.ruby-lang.org/issues/13019#change-61972 * Author: Yura Sokolov * Status: Open * Priority: Normal * Assignee: * ruby -v: * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- Previous implementation had an issues: - macros murmur1 assumes murmur_step takes rotation value as a second argument - but murmur_step second argument is "next block" - this makes st_hash_uint and st_hash_end to not mix high bits of hash value into lower bits - this leads to pure hash behavior on doubles and mixing hashes using st_hash_uint. It didn't matter when bins amount were prime numbers, but it hurts when bins are powers of two. Mistake were created cause of attempt to co-exist Murmur1 and Murmur2 in a same code. Change it to single hash-function implementation. - block function is in a spirit of Murmur functions, but handles inter-block dependency a bit better (imho). - final block is read in bit more optimal way on CPU with unaligned word access, - final block is mixed in simple way, - finalizer is taken from MurmurHash3 (it makes most of magic :) ) (64bit finalizer is taken from http://zimbry.blogspot.ru/2011/09/better-bit-mixing-improving-on.html) Also remove ST_USE_FNV1: it lacks implementation of many functions, and looks to be abandoned ---Files-------------------------------- 0001-st.c-fix-st_hash-functions.patch (10.9 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: