summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-06-11 07:02:23 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-06-11 07:02:23 +0000
commit22010642b24f2b3f2bfef1324c61764dcd8cc2fd (patch)
treedd8a8256032a8c6ef07ac3ae8c6464c11282f104 /bignum.c
parenta5fd4cec841d2ae50d2aaff8f564da4842d0984c (diff)
* eval.c (rb_eval): ruby_frame->last_func may be null, if it's
called outside of a method. * parse.y (arg): use INT2NUM, not INT2FIX for tUMINUS. * parse.y (arg): unnecessary negative tPOW treatment. * parse.y (tokadd_escape): wrong backslash escapement. * parse.y (stmt,arg): too much void value check. * parse.y (stmt,arg): need to check void value on rules which does not use node_assign(). * ext/socket/socket.c (ipaddr): need not to taint hostnames. * range.c (range_include): should be based on "<=>", whereas member? still is based on "each". * range.c (range_min,range_max): redefine methods based on "<=>". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/bignum.c b/bignum.c
index 7955fe22bd..71e33470fd 100644
--- a/bignum.c
+++ b/bignum.c
@@ -1352,20 +1352,18 @@ rb_big_pow(x, y)
case T_FIXNUM:
yy = NUM2LONG(y);
if (yy > 0) {
- VALUE z;
+ VALUE z = x;
- z = x;
for (;;) {
- yy = yy - 1;
+ yy -= 1;
if (yy == 0) break;
while (yy % 2 == 0) {
- yy = yy / 2;
+ yy /= 2;
x = rb_big_mul(x, x);
}
z = rb_big_mul(z, x);
}
- if (!FIXNUM_P(z)) z = bignorm(z);
- return z;
+ return bignorm(z);
}
d = (double)yy;
break;