From b2b33db3552e1c99bf9842a36fa30c064fc5a5d6 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 7 Sep 2006 16:35:59 +0000 Subject: * numeric.c (fix_plus): addition in Fixnum will never overflow long. a patch from Ondrej Bilka . [ruby-core:08794] * numeric.c (fix_minus): ditto. * bignum.c (rb_big_pow): eagerly truncate resulting bignum. [ruby-core:08794] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- bignum.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'bignum.c') diff --git a/bignum.c b/bignum.c index 6a7a83c085..df702e26ca 100644 --- a/bignum.c +++ b/bignum.c @@ -1617,8 +1617,10 @@ rb_big_pow(x, y) while (yy % 2 == 0) { yy /= 2; x = rb_big_mul(x, x); + if (!BDIGITS(x)[RBIGNUM(x)->len-1]) RBIGNUM(x)->len--; } z = rb_big_mul(z, x); + if (!BDIGITS(z)[RBIGNUM(z)->len-1]) RBIGNUM(z)->len--; } return bignorm(z); } -- cgit v1.2.3