summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-08 02:48:39 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-08 02:48:39 +0000
commit120a9d2f8336935d5f1b346c3df01c7ceb7505fd (patch)
tree7e9c343330021f7315abbe806de5ce636c59bac8 /bignum.c
parentb42698eaff77b1894176104bb32b5c7396eb3361 (diff)
* bignum.c (rb_big2str0): should not use RTEST for non-VALUE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/bignum.c b/bignum.c
index 7aed3af8aa..c33bbaba70 100644
--- a/bignum.c
+++ b/bignum.c
@@ -746,7 +746,7 @@ big2str_find_n1(VALUE x, int base)
4.95419631038688, 5.0, 5.04439411935845,
5.08746284125034, 5.12928301694497, 5.16992500144231
};
- long bits, n, i;
+ long bits;
if (base < 2 && 36 < base)
rb_bug("illegal radix %d", base);
@@ -867,15 +867,15 @@ rb_big2str0(VALUE x, int base, int trim)
#if SIZEOF_BDIGITS > 2
hbase *= hbase;
#endif
- off = !RTEST(trim) || !RBIGNUM(x)->sign;
+ off = !(trim && RBIGNUM(x)->sign); /* erase plus sign if trim */
xx = rb_big_clone(x);
RBIGNUM(xx)->sign = 1;
if (n1 <= KARATSUBA_DIGITS) {
- len = off + big2str_orig(xx, base, ptr + off, 2*n1, hbase, RTEST(trim));
+ len = off + big2str_orig(xx, base, ptr + off, 2*n1, hbase, trim);
}
else {
len = off + big2str_karatsuba(xx, base, ptr + off, n1,
- 2*n1, hbase, RTEST(trim));
+ 2*n1, hbase, trim);
}
ptr[len] = '\0';
@@ -1162,7 +1162,7 @@ rb_big_eq(VALUE x, VALUE y)
case T_BIGNUM:
break;
case T_FLOAT:
- {
+ {
volatile double a, b;
a = RFLOAT(y)->value;
@@ -1310,7 +1310,7 @@ bigadd(VALUE x, VALUE y, int sign)
if (RBIGNUM(x)->len > RBIGNUM(y)->len) {
len = RBIGNUM(x)->len + 1;
- z = x; x = y; y = z;
+ z = x; x = y; y = z;
}
else {
len = RBIGNUM(y)->len + 1;