зеркало из https://github.com/github/ruby.git
* bignum.c (rb_big_pow): removed invariant variable. [ruby-dev:31236]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
cba32dcaa6
Коммит
66e1be60c3
|
@ -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 22:24:37 2007 pegacorn <subscriber.jp AT gmail.com>
|
||||
|
||||
* ext/dl/cfunc.c (rb_dlcfunc_call): adjust format. [ruby-dev:31222]
|
||||
|
|
18
bignum.c
18
bignum.c
|
@ -1674,7 +1674,7 @@ rb_big_pow(VALUE x, VALUE y)
|
|||
yy = FIX2LONG(y);
|
||||
if (yy > 0) {
|
||||
VALUE z = 0;
|
||||
SIGNED_VALUE mask, n = 1;
|
||||
SIGNED_VALUE mask;
|
||||
|
||||
if (RBIGNUM(x)->len * SIZEOF_BDIGITS * yy > 1024*1024) {
|
||||
rb_warn("in a**b, b may be too big");
|
||||
|
@ -1682,21 +1682,9 @@ rb_big_pow(VALUE x, VALUE y)
|
|||
break;
|
||||
}
|
||||
for (mask = FIXNUM_MAX + 1; mask; mask >>= 1) {
|
||||
if (!z) {
|
||||
SIGNED_VALUE 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);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#define RUBY_VERSION "1.9.0"
|
||||
#define RUBY_RELEASE_DATE "2007-07-15"
|
||||
#define RUBY_RELEASE_DATE "2007-07-16"
|
||||
#define RUBY_VERSION_CODE 190
|
||||
#define RUBY_RELEASE_CODE 20070715
|
||||
#define RUBY_RELEASE_CODE 20070716
|
||||
#define RUBY_PATCHLEVEL 0
|
||||
|
||||
#define RUBY_VERSION_MAJOR 1
|
||||
|
@ -9,7 +9,7 @@
|
|||
#define RUBY_VERSION_TEENY 0
|
||||
#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[];
|
||||
|
|
Загрузка…
Ссылка в новой задаче