summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--bignum.c18
-rw-r--r--version.h6
3 files changed, 10 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index d3672f9856..26930f51a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Mon Jul 16 00:26:10 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_big_pow): removed invariant variable. [ruby-dev:31236]
+
Sun Jul 15 23:59:57 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* bignum.c (rb_big_neg): SIGNED_VALUE isn't in 1.8.
diff --git a/bignum.c b/bignum.c
index 788db18dd1..5763e8c72f 100644
--- a/bignum.c
+++ b/bignum.c
@@ -1754,7 +1754,7 @@ rb_big_pow(x, y)
yy = FIX2LONG(y);
if (yy > 0) {
VALUE z = 0;
- long mask, n = 1;
+ long mask;
if (RBIGNUM(x)->len * SIZEOF_BDIGITS * yy > 1024*1024) {
rb_warn("in a**b, b may be too big");
@@ -1762,21 +1762,9 @@ rb_big_pow(x, y)
break;
}
for (mask = FIXNUM_MAX + 1; mask; mask >>= 1) {
- if (!z) {
- long n2 = n * n;
- if (!POSFIXABLE(n2) || (n2 / n != n)) {
- z = bigtrunc(bigsqr(rb_int2big(n)));
- }
- else {
- n = n2;
- }
- }
- else {
- z = bigtrunc(bigsqr(z));
- }
+ if (z) z = bigtrunc(bigsqr(z));
if (yy & mask) {
- if (!z) z = rb_int2big(n);
- z = bigtrunc(rb_big_mul0(z, x));
+ z = z ? bigtrunc(rb_big_mul0(z, x)) : x;
}
}
return bignorm(z);
diff --git a/version.h b/version.h
index 4f97fe2f29..c176c8a573 100644
--- a/version.h
+++ b/version.h
@@ -1,7 +1,7 @@
#define RUBY_VERSION "1.8.6"
-#define RUBY_RELEASE_DATE "2007-07-15"
+#define RUBY_RELEASE_DATE "2007-07-16"
#define RUBY_VERSION_CODE 186
-#define RUBY_RELEASE_CODE 20070715
+#define RUBY_RELEASE_CODE 20070716
#define RUBY_PATCHLEVEL 5000
#define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 6
#define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 7
-#define RUBY_RELEASE_DAY 15
+#define RUBY_RELEASE_DAY 16
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];