ruby-changes:54729
From: nobu <ko1@a...>
Date: Wed, 30 Jan 2019 14:08:40 +0900 (JST)
Subject: [ruby-changes:54729] nobu:r66946 (trunk): hash.c: hoisted out st_index_hash
nobu 2019-01-30 14:08:36 +0900 (Wed, 30 Jan 2019) New Revision: 66946 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66946 Log: hash.c: hoisted out st_index_hash Modified files: trunk/hash.c Index: hash.c =================================================================== --- hash.c (revision 66945) +++ hash.c (revision 66946) @@ -260,16 +260,19 @@ key64_hash(uint64_t key, uint32_t seed) https://github.com/ruby/ruby/blob/trunk/hash.c#L260 return mult_and_mix(key + seed, prime1); } +/* Should cast down the result for each purpose */ +#define st_index_hash(index) key64_hash(rb_hash_start(index), prime2) + long rb_objid_hash(st_index_t index) { - return (long)key64_hash(rb_hash_start(index), prime2); + return (long)st_index_hash(index); } static st_index_t objid_hash(VALUE obj) { - return rb_objid_hash((st_index_t)obj); + return (st_index_t)st_index_hash((st_index_t)obj); } VALUE @@ -300,7 +303,7 @@ rb_ident_hash(st_data_t n) https://github.com/ruby/ruby/blob/trunk/hash.c#L303 } #endif - return (st_index_t)key64_hash(rb_hash_start((st_index_t)n), prime2); + return (st_index_t)st_index_hash((st_index_t)n); } static const struct st_hash_type identhash = { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/