From e31b67700b8c71061bd0ee33a7235d423ca6f6f0 Mon Sep 17 00:00:00 2001 From: usa Date: Fri, 21 Dec 2012 15:30:44 +0000 Subject: [PATCH] * 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 --- ChangeLog | 6 ++++++ object.c | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4c79830f5a..bc9d742fff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sat Dec 22 00:28:46 2012 NAKAMURA Usaku + + * 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] + Fri Dec 21 23:15:25 2012 Kouhei Sutou * ext/fiddle/lib/fiddle/struct.rb (Fiddle::CStructEntity#set_ctypes): 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); }