ruby-changes:7771
From: matz <ko1@a...>
Date: Thu, 11 Sep 2008 11:41:16 +0900 (JST)
Subject: [ruby-changes:7771] Ruby:r19292 (trunk): * bignum.c (big2str_karatsuba): remove unnecessary fixnum code. a
matz 2008-09-11 11:40:52 +0900 (Thu, 11 Sep 2008) New Revision: 19292 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19292 Log: * bignum.c (big2str_karatsuba): remove unnecessary fixnum code. a patch from TOYOFUKU Chikanobu <nobu_toyofuku at nifty.com> in [ruby-dev:36217]. Modified files: trunk/ChangeLog trunk/bignum.c Index: ChangeLog =================================================================== --- ChangeLog (revision 19291) +++ ChangeLog (revision 19292) @@ -19,6 +19,12 @@ * tool/compile_prelude.rb: print "<internal:prelude>" instead of "prelude.rb" on stack trace. [ruby-dev:36129] +Wed Sep 10 21:19:58 2008 Yukihiro Matsumoto <matz@r...> + + * bignum.c (big2str_karatsuba): remove unnecessary fixnum code. a + patch from TOYOFUKU Chikanobu <nobu_toyofuku at nifty.com> in + [ruby-dev:36217]. + Wed Sep 10 21:09:32 2008 Masaki Suketa <masaki.suketa@n...> * test/win32ole/test_err_in_callback.rb: InternetExplorer should Index: bignum.c =================================================================== --- bignum.c (revision 19291) +++ bignum.c (revision 19292) @@ -893,21 +893,6 @@ long lh, ll, m1; VALUE b, q, r; - if (FIXNUM_P(x)) { - VALUE str = rb_fix2str(x, base); - char* str_ptr = RSTRING_PTR(str); - long str_len = RSTRING_LEN(str); - if (trim) { - if (FIX2INT(x) == 0) return 0; - MEMCPY(ptr, str_ptr, char, str_len); - return str_len; - } - else { - memset(ptr, '0', len - str_len); - MEMCPY(ptr + len - str_len, str_ptr, char, str_len); - return len; - } - } if (BIGZEROP(x)) { if (trim) return 0; else { @@ -922,10 +907,10 @@ b = power_cache_get_power(base, n1, &m1); bigdivmod(x, b, &q, &r); - lh = big2str_karatsuba(q, base, ptr, (len - m1)/2, + lh = big2str_karatsuba(q, base, ptr, (len - m1)/2, len - m1, hbase, trim); ll = big2str_karatsuba(r, base, ptr + lh, m1/2, - m1, hbase, !lh && trim); + m1, hbase, !lh && trim); return lh + ll; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/