ruby-changes:4108
From: ko1@a...
Date: Mon, 25 Feb 2008 15:35:06 +0900 (JST)
Subject: [ruby-changes:4108] usa - Ruby:r15598 (trunk): * bignum.c (big2str_karatsuba): initialize cache if not initialized.
usa 2008-02-25 15:34:38 +0900 (Mon, 25 Feb 2008)
New Revision: 15598
Modified files:
trunk/ChangeLog
trunk/bignum.c
Log:
* bignum.c (big2str_karatsuba): initialize cache if not initialized.
* bignum.c (Init_Bignum): delayed initializing cache.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15598&r2=15597&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/bignum.c?r1=15598&r2=15597&diff_format=u
Index: ChangeLog
===================================================================
--- ChangeLog (revision 15597)
+++ ChangeLog (revision 15598)
@@ -1,3 +1,9 @@
+Mon Feb 25 15:33:29 2008 NAKAMURA Usaku <usa@r...>
+
+ * bignum.c (big2str_karatsuba): initialize cache if not initialized.
+
+ * bignum.c (Init_Bignum): delayed initializing cache.
+
Mon Feb 25 13:40:03 2008 Tanaka Akira <akr@f...>
* process.c (Init_process): share bignum objects for RLIM_INFINITY,
Index: bignum.c
===================================================================
--- bignum.c (revision 15597)
+++ bignum.c (revision 15598)
@@ -737,6 +737,7 @@
#define MAX_BIG2STR_TABLE_ENTRIES 64
static VALUE big2str_power_cache[35][MAX_BIG2STR_TABLE_ENTRIES];
+static int power_cache_initialized = 0;
static void
power_cache_init(void)
@@ -901,6 +902,10 @@
return big2str_orig(x, base, ptr, len, hbase, trim);
}
+ if (!power_cache_initialized) {
+ power_cache_init();
+ power_cache_initialized = 1;
+ }
b = power_cache_get_power(base, n1, &m1);
bigdivmod(x, b, &q, &r);
lh = big2str_karatsuba(q, base, ptr, (len - m1)/2,
@@ -2605,6 +2610,4 @@
rb_define_method(rb_cBignum, "size", rb_big_size, 0);
rb_define_method(rb_cBignum, "odd?", rb_big_odd_p, 0);
rb_define_method(rb_cBignum, "even?", rb_big_even_p, 0);
-
- power_cache_init();
}
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/