Revision: 570 http://trac.macosforge.org/projects/ruby/changeset/570 Author: lsansonetti@apple.com Date: 2008-09-07 16:42:34 -0700 (Sun, 07 Sep 2008) Log Message: ----------- make sure rb_hash() does not return a bignum Modified Paths: -------------- MacRuby/trunk/hash.c Modified: MacRuby/trunk/hash.c =================================================================== --- MacRuby/trunk/hash.c 2008-09-07 23:42:14 UTC (rev 569) +++ MacRuby/trunk/hash.c 2008-09-07 23:42:34 UTC (rev 570) @@ -37,7 +37,13 @@ VALUE rb_hash(VALUE obj) { - return rb_funcall(obj, id_hash, 0); + VALUE v = rb_funcall(obj, id_hash, 0); + if (TYPE(v) == T_BIGNUM) { + unsigned long l = NUM2ULONG(v); + l /= 2.0; + v = ULONG2NUM(l); + } + return v; } typedef int st_foreach_func(st_data_t, st_data_t, st_data_t);
participants (1)
-
source_changes@macosforge.org