mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* bignum.c (rb_big_odd_p): Check the bignum length.
(rb_big_even_p): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ff84827eb6
commit
fe6273975e
2 changed files with 7 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
|||
Wed Aug 7 20:05:38 2013 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* 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@fsij.org>
|
||||
|
||||
* bignum.c (dbl2big): A condition simplified.
|
||||
|
|
4
bignum.c
4
bignum.c
|
@ -6559,7 +6559,7 @@ rb_big_size(VALUE big)
|
|||
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)
|
|||
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;
|
||||
|
|
Loading…
Add table
Reference in a new issue