summaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-08 13:10:04 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-08 13:10:04 +0000
commit31b7ae00c05aef76416c767df92be45d62e9d06a (patch)
tree87743fd1893484f1af704d20e3695810ea21a893 /proc.c
parent034414741e4616f7a305f12fe36e1f9a6b0ff074 (diff)
* include/ruby/st.h (st_hash_func): use st_index_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/proc.c b/proc.c
index 39a66976c1..710de3915d 100644
--- a/proc.c
+++ b/proc.c
@@ -771,12 +771,13 @@ proc_eq(VALUE self, VALUE other)
static VALUE
proc_hash(VALUE self)
{
- long hash;
+ st_index_t hash;
rb_proc_t *proc;
GetProcPtr(self, proc);
- hash = (long)proc->block.iseq;
- hash ^= (long)proc->envval;
- hash ^= (long)proc->block.lfp >> 16;
+ hash = rb_hash_start((st_index_t)proc->block.iseq);
+ hash = rb_hash_uint(hash, (st_index_t)proc->envval);
+ hash = rb_hash_uint(hash, (st_index_t)proc->block.lfp >> 16);
+ hash = rb_hash_end(hash);
return LONG2FIX(hash);
}
@@ -993,12 +994,13 @@ static VALUE
method_hash(VALUE method)
{
struct METHOD *m;
- long hash;
+ st_index_t hash;
TypedData_Get_Struct(method, struct METHOD, &method_data_type, m);
- hash = (long)m->rclass;
- hash ^= (long)m->recv;
- hash ^= (long)m->me.def;
+ hash = rb_hash_start((st_index_t)m->rclass);
+ hash = rb_hash_uint(hash, (st_index_t)m->recv);
+ hash = rb_hash_uint(hash, (st_index_t)m->me.def);
+ hash = rb_hash_end(hash);
return INT2FIX(hash);
}