1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/include/ruby
nobu c0ff5f4dd7 st.c: fix st_hash* functions [Bug #13019]
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

Author: Sokolov Yura aka funny_falcon <funny.falcon@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-21 06:22:16 +00:00
..
backward * include/ruby/backward/util.h: Good-by Borland-C. 2015-10-18 05:41:34 +00:00
backward.h remove backward macros 2016-06-14 14:43:02 +00:00
debug.h * include/ruby/debug.h, 2013-10-09 00:21:51 +00:00
defines.h Suppress warning: this use of "defined" may not be portable 2016-12-09 22:45:38 +00:00
encoding.h encoding.h: include ruby/ruby.h 2016-10-23 02:41:43 +00:00
intern.h Revert changes on rb_frame_method_id_and_class() 2016-12-04 05:40:18 +00:00
io.h * configure.in: check function attirbute const and pure, 2016-05-08 17:44:51 +00:00
missing.h missing.h: isfinite 2016-05-23 12:33:39 +00:00
onigmo.h Merge Onigmo 6.0.0 2016-12-10 17:47:04 +00:00
oniguruma.h Merge Onigmo 6.0.0 2016-12-10 17:47:04 +00:00
re.h re.c: rb_reg_region_copy 2014-12-01 21:30:58 +00:00
regex.h defines.h: RUBY_SYMBOL_EXPORT_{BEGIN,END} 2013-04-05 10:29:38 +00:00
ruby.h ruby.h: add prefix 2016-12-09 03:25:20 +00:00
st.h st.c: fix st_hash* functions [Bug #13019] 2016-12-21 06:22:16 +00:00
subst.h
thread.h defines.h: RUBY_SYMBOL_EXPORT_{BEGIN,END} 2013-04-05 10:29:38 +00:00
thread_native.h * ext/openssl/depend: remove dependency from internal headers. 2014-05-14 10:55:38 +00:00
util.h util.h: POSIX-noncompliant setenv 2016-09-07 08:50:39 +00:00
version.h version.h (RUBY_VERSION): 2.4.0 development has started. 2015-12-25 12:40:38 +00:00
vm.h defines.h: RUBY_SYMBOL_EXPORT_{BEGIN,END} 2013-04-05 10:29:38 +00:00
win32.h declare rb_w32_sysinit in header. 2016-12-13 05:17:48 +00:00