mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
hash.c: hoisted out st_index_hash
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a94b78e418
commit
e1e3d642bf
1 changed files with 6 additions and 3 deletions
9
hash.c
9
hash.c
|
@ -260,16 +260,19 @@ key64_hash(uint64_t key, uint32_t seed)
|
||||||
return mult_and_mix(key + seed, prime1);
|
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
|
long
|
||||||
rb_objid_hash(st_index_t index)
|
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
|
static st_index_t
|
||||||
objid_hash(VALUE obj)
|
objid_hash(VALUE obj)
|
||||||
{
|
{
|
||||||
return rb_objid_hash((st_index_t)obj);
|
return (st_index_t)st_index_hash((st_index_t)obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
|
@ -300,7 +303,7 @@ rb_ident_hash(st_data_t n)
|
||||||
}
|
}
|
||||||
#endif
|
#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 = {
|
static const struct st_hash_type identhash = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue