summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-18 04:46:04 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-18 04:46:04 +0000
commit8c36fc30c24bd34d2686e68fc6e1a5d6584bd248 (patch)
treecf7d4c0ffbc09525c9a33cb7c04fb28e6e6a574a /bignum.c
parent39b33658e3764ee621a9c2c9cc003e21da4e327e (diff)
add casts
* encoding.c (load_encoding): explicit cast to suppress warning. Though the cast truncates some bits, from heuristic analysis I believe it is OK to do so here. * bignum.c (rb_cstr_to_inum): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/bignum.c b/bignum.c
index 30e1e8a8e9..e98648af24 100644
--- a/bignum.c
+++ b/bignum.c
@@ -731,7 +731,7 @@ rb_cstr_to_inum(const char *str, int base, int badcheck)
if (badcheck) goto bad;
break;
}
- nondigit = c;
+ nondigit = (char) c;
continue;
}
else if ((c = conv_digit(c)) < 0) {
@@ -1036,7 +1036,8 @@ big2str_find_n1(VALUE x, int base)
bits = BITSPERDIG*RBIGNUM_LEN(x);
}
- return (long)ceil(bits/log_2[base - 2]);
+ /* @shyouhei note: vvvvvvvvvvvvv this cast is suspicious. But I believe it is OK, because if that cast loses data, this x value is too big, and should have raised RangeError. */
+ return (long)ceil(((double)bits)/log_2[base - 2]);
}
static long