summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-21 15:30:44 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-21 15:30:44 +0000
commite31b67700b8c71061bd0ee33a7235d423ca6f6f0 (patch)
tree343c458a70802ee2a9edcc9aff286ab169e18413 /object.c
parent8346f7b2ad3138bdc30c8b39c8de13f3b392c059 (diff)
* object.c (rb_obj_hash): shouldn't assume object_id can be long.
based on a patch by Heesob Park at [ruby-core:51060]. cf. [Backport #7454] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 b05b41be25..13765bc621 100644
--- a/object.c
+++ b/object.c
@@ -125,7 +125,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);
}