summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/hash.c b/hash.c
index 0f5d418534..a5de9fde07 100644
--- a/hash.c
+++ b/hash.c
@@ -273,10 +273,14 @@ rb_objid_hash(st_index_t index)
static st_index_t
objid_hash(VALUE obj)
{
+ VALUE object_id = rb_obj_id(obj);
+ if (!FIXNUM_P(object_id))
+ object_id = rb_big_hash(object_id);
+
#if SIZEOF_LONG == SIZEOF_VOIDP
- return (st_index_t)st_index_hash((st_index_t)NUM2LONG(rb_obj_id(obj)));
+ return (st_index_t)st_index_hash((st_index_t)NUM2LONG(object_id));
#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
- return (st_index_t)st_index_hash((st_index_t)NUM2LL(rb_obj_id(obj)));
+ return (st_index_t)st_index_hash((st_index_t)NUM2LL(object_id));
#endif
}