* bignum.c (big2str_karatsuba): remove unnecessary fixnum code. a

patch from TOYOFUKU Chikanobu <nobu_toyofuku at nifty.com> in
  [ruby-dev:36217].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-09-11 02:40:52 +00:00
Родитель 5cebd7135d
Коммит ba75344338
2 изменённых файлов: 8 добавлений и 17 удалений

Просмотреть файл

@ -19,6 +19,12 @@ Wed Sep 10 23:00:43 2008 Yusuke Endoh <mame@tsg.ne.jp>
* 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@ruby-lang.org>
* 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@nifty.ne.jp>
* test/win32ole/test_err_in_callback.rb: InternetExplorer should

Просмотреть файл

@ -893,21 +893,6 @@ big2str_karatsuba(VALUE x, int base, char* ptr,
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 @@ big2str_karatsuba(VALUE x, int base, char* ptr,
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;
}