Revision: 3831 http://trac.macosforge.org/projects/ruby/changeset/3831 Author: pthomson@apple.com Date: 2010-03-19 15:42:44 -0700 (Fri, 19 Mar 2010) Log Message: ----------- Fix random generation of bignums on 64-bit 10.6+ machines. Modified Paths: -------------- MacRuby/trunk/random.c Modified: MacRuby/trunk/random.c =================================================================== --- MacRuby/trunk/random.c 2010-03-19 22:36:34 UTC (rev 3830) +++ MacRuby/trunk/random.c 2010-03-19 22:42:44 UTC (rev 3831) @@ -473,7 +473,11 @@ static VALUE limited_big_rand(struct MT *mt, struct RBignum *limit) { +#if SIZEOF_BDIGITS < 8 const long len = (RBIGNUM_LEN(limit) * SIZEOF_BDIGITS + 3) / 4; +#else + const long len = (RBIGNUM_LEN(limit) * SIZEOF_BDIGITS + 3) / 8; +#endif struct RBignum *val = (struct RBignum *)rb_big_clone((VALUE)limit); RBIGNUM_SET_SIGN(val, 1); #if SIZEOF_BDIGITS == 2