diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-08 02:48:39 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-08 02:48:39 +0000 |
commit | a580b02b4d243a929064d2841d5aa6edba0f7f45 (patch) | |
tree | 7e9c343330021f7315abbe806de5ce636c59bac8 | |
parent | 668cdc36f990de3cac48c8b8f1c1fa2770fe9899 (diff) | |
download | ruby-a580b02b4d243a929064d2841d5aa6edba0f7f45.tar.gz ruby-a580b02b4d243a929064d2841d5aa6edba0f7f45.tar.xz ruby-a580b02b4d243a929064d2841d5aa6edba0f7f45.zip |
* bignum.c (rb_big2str0): should not use RTEST for non-VALUE.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@12903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | bignum.c | 12 |
2 files changed, 10 insertions, 6 deletions
@@ -1,3 +1,7 @@ +Wed Aug 8 11:48:37 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * bignum.c (rb_big2str0): should not use RTEST for non-VALUE. + Wed Aug 8 11:25:25 2007 NAKAMURA Usaku <usa@ruby-lang.org> * bignum.c (rb_big2str0): should preserve sign mark. @@ -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; |