mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* bignum.c (bigfixize): zero length Bignum is 0.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0f71c10acb
commit
96c31ac787
2 changed files with 6 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
Fri Mar 13 09:30:12 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* bignum.c (bigfixize): zero length Bignum is 0.
|
||||
|
||||
Fri Mar 13 08:06:48 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* util.c (rv_strdup): macro to duplicate nul-terminated string.
|
||||
|
|
3
bignum.c
3
bignum.c
|
@ -191,7 +191,8 @@ bigfixize(VALUE x)
|
|||
long len = RBIGNUM_LEN(x);
|
||||
BDIGIT *ds = BDIGITS(x);
|
||||
|
||||
if (len > 0 && len*SIZEOF_BDIGITS <= sizeof(long)) {
|
||||
if (len == 0) return INT2FIX(0);
|
||||
if (len*SIZEOF_BDIGITS <= sizeof(long)) {
|
||||
long num = 0;
|
||||
#if 2*SIZEOF_BDIGITS > SIZEOF_LONG
|
||||
num = (long)ds[0];
|
||||
|
|
Loading…
Reference in a new issue