[macruby-changes] [3831] MacRuby/trunk/random.c
source_changes at macosforge.org
source_changes at macosforge.org
Fri Mar 19 15:42:45 PDT 2010
Revision: 3831
http://trac.macosforge.org/projects/ruby/changeset/3831
Author: pthomson at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100319/9387d2f7/attachment.html>
More information about the macruby-changes
mailing list