* bignum.c (nlz): Cast the result explicitly.

(big2dbl): Don't assign BDIGIT values to int variable.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2013-06-18 03:56:49 +00:00
parent b5c81904e6
commit e3b98ca301
2 changed files with 9 additions and 3 deletions

View File

@ -1,3 +1,8 @@
Tue Jun 18 12:53:25 2013 Tanaka Akira <akr@fsij.org>
* bignum.c (nlz): Cast the result explicitly.
(big2dbl): Don't assign BDIGIT values to int variable.
Tue Jun 18 12:25:16 2013 Tanaka Akira <akr@fsij.org> Tue Jun 18 12:25:16 2013 Tanaka Akira <akr@fsij.org>
* bignum.c (rb_big_xor): Non-effective code removed. * bignum.c (rb_big_xor): Non-effective code removed.

View File

@ -2398,7 +2398,7 @@ nlz(BDIGIT x)
y = x >> 4; if (y) {n -= 4; x = y;} y = x >> 4; if (y) {n -= 4; x = y;}
y = x >> 2; if (y) {n -= 2; x = y;} y = x >> 2; if (y) {n -= 2; x = y;}
y = x >> 1; if (y) {return n - 2;} y = x >> 1; if (y) {return n - 2;}
return n - x; return (int)(n - x);
} }
static double static double
@ -2423,10 +2423,11 @@ big2dbl(VALUE x)
} }
dl = ds[i]; dl = ds[i];
if (bits && (dl & (1UL << (bits %= BITSPERDIG)))) { if (bits && (dl & (1UL << (bits %= BITSPERDIG)))) {
int carry = dl & ~(~(BDIGIT)0 << bits); int carry = (dl & ~(~(BDIGIT)0 << bits)) != 0;
if (!carry) { if (!carry) {
while (i-- > 0) { while (i-- > 0) {
if ((carry = ds[i]) != 0) break; carry = ds[i] != 0;
if (carry) break;
} }
} }
if (carry) { if (carry) {