summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
Diffstat (limited to 'object.c')
-rw-r--r--object.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/object.c b/object.c
index 2c0aa7d8e2..e8cb3283ba 100644
--- a/object.c
+++ b/object.c
@@ -112,7 +112,14 @@ VALUE
rb_obj_hash(VALUE obj)
{
VALUE oid = rb_obj_id(obj);
- st_index_t h = rb_hash_end(rb_hash_start(NUM2LONG(oid)));
+#if SIZEOF_LONG == SIZEOF_VOIDP
+ st_index_t index = NUM2LONG(oid);
+#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
+ st_index_t index = NUM2LL(oid);
+#else
+# error not supported
+#endif
+ st_index_t h = rb_hash_end(rb_hash_start(index));
return LONG2FIX(h);
}