ruby-changes:30355
From: akr <ko1@a...>
Date: Wed, 7 Aug 2013 20:08:11 +0900 (JST)
Subject: [ruby-changes:30355] akr:r42424 (trunk): * bignum.c (rb_big_odd_p): Check the bignum length.
akr 2013-08-07 20:08:03 +0900 (Wed, 07 Aug 2013) New Revision: 42424 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42424 Log: * bignum.c (rb_big_odd_p): Check the bignum length. (rb_big_even_p): Ditto. Modified files: trunk/ChangeLog trunk/bignum.c _______________________________________________ ruby-cvs mailing list ruby-cvs@r... http://lists.ruby-lang.org/cgi-bin/mailman/listinfo/ruby-cvs Index: ChangeLog =================================================================== --- ChangeLog (revision 42423) +++ ChangeLog (revision 42424) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Aug 7 20:05:38 2013 Tanaka Akira <akr@f...> + + * bignum.c (rb_big_odd_p): Check the bignum length. + (rb_big_even_p): Ditto. + Wed Aug 7 19:29:26 2013 Tanaka Akira <akr@f...> * bignum.c (dbl2big): A condition simplified. Index: bignum.c =================================================================== --- bignum.c (revision 42423) +++ bignum.c (revision 42424) @@ -6559,7 +6559,7 @@ rb_big_size(VALUE big) https://github.com/ruby/ruby/blob/trunk/bignum.c#L6559 static VALUE rb_big_odd_p(VALUE num) { - if (BDIGITS(num)[0] & 1) { + if (RBIGNUM_LEN(num) != 0 && BDIGITS(num)[0] & 1) { return Qtrue; } return Qfalse; @@ -6575,7 +6575,7 @@ rb_big_odd_p(VALUE num) https://github.com/ruby/ruby/blob/trunk/bignum.c#L6575 static VALUE rb_big_even_p(VALUE num) { - if (BDIGITS(num)[0] & 1) { + if (RBIGNUM_LEN(num) != 0 && BDIGITS(num)[0] & 1) { return Qfalse; } return Qtrue; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/