aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-18 03:56:49 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-18 03:56:49 +0000
commite3b98ca301beaa34c09be7b20f9a7729b26f3eb1 (patch)
tree4d87a52964fa191c92b3f889f8cfe35f2eb48a50
parentb5c81904e6239a414eb90d8658549d5efe4fea7f (diff)
downloadruby-e3b98ca301beaa34c09be7b20f9a7729b26f3eb1.tar.gz
* 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
-rw-r--r--ChangeLog5
-rw-r--r--bignum.c7
2 files changed, 9 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 99f52cfea1..3c7789f78b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* bignum.c (rb_big_xor): Non-effective code removed.
diff --git a/bignum.c b/bignum.c
index dbe1a3353b..af7d115e02 100644
--- a/bignum.c
+++ b/bignum.c
@@ -2398,7 +2398,7 @@ nlz(BDIGIT x)
y = x >> 4; if (y) {n -= 4; x = y;}
y = x >> 2; if (y) {n -= 2; x = y;}
y = x >> 1; if (y) {return n - 2;}
- return n - x;
+ return (int)(n - x);
}
static double
@@ -2423,10 +2423,11 @@ big2dbl(VALUE x)
}
dl = ds[i];
if (bits && (dl & (1UL << (bits %= BITSPERDIG)))) {
- int carry = dl & ~(~(BDIGIT)0 << bits);
+ int carry = (dl & ~(~(BDIGIT)0 << bits)) != 0;
if (!carry) {
while (i-- > 0) {
- if ((carry = ds[i]) != 0) break;
+ carry = ds[i] != 0;
+ if (carry) break;
}
}
if (carry) {