ruby-changes:29323
From: akr <ko1@a...>
Date: Tue, 18 Jun 2013 12:56:58 +0900 (JST)
Subject: [ruby-changes:29323] akr:r41375 (trunk): * bignum.c (nlz): Cast the result explicitly.
akr 2013-06-18 12:56:49 +0900 (Tue, 18 Jun 2013) New Revision: 41375 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41375 Log: * bignum.c (nlz): Cast the result explicitly. (big2dbl): Don't assign BDIGIT values to int variable. Modified files: trunk/ChangeLog trunk/bignum.c Index: ChangeLog =================================================================== --- ChangeLog (revision 41374) +++ ChangeLog (revision 41375) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Jun 18 12:53:25 2013 Tanaka Akira <akr@f...> + + * 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@f...> * bignum.c (rb_big_xor): Non-effective code removed. Index: bignum.c =================================================================== --- bignum.c (revision 41374) +++ bignum.c (revision 41375) @@ -2398,7 +2398,7 @@ nlz(BDIGIT x) https://github.com/ruby/ruby/blob/trunk/bignum.c#L2398 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) https://github.com/ruby/ruby/blob/trunk/bignum.c#L2423 } 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) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/