mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* bignum.c (get2comp): do nothing for empty Bignum. [ruby-dev:31225]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
fa1bfaf741
commit
b47daf811a
2 changed files with 6 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
Sun Jul 15 21:07:43 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* bignum.c (get2comp): do nothing for empty Bignum. [ruby-dev:31225]
|
||||
|
||||
Sun Jul 15 19:05:28 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* bignum.c (rb_cstr_to_inum): check leading non-digits.
|
||||
|
|
3
bignum.c
3
bignum.c
|
@ -104,7 +104,7 @@ bigtrunc(x)
|
|||
long len = RBIGNUM(x)->len;
|
||||
BDIGIT *ds = BDIGITS(x);
|
||||
|
||||
while (len-- && !ds[len]);
|
||||
while (--len && !ds[len]);
|
||||
RBIGNUM(x)->len = ++len;
|
||||
return x;
|
||||
}
|
||||
|
@ -1100,6 +1100,7 @@ rb_big_neg(x)
|
|||
if (!RBIGNUM(x)->sign) get2comp(z);
|
||||
ds = BDIGITS(z);
|
||||
i = RBIGNUM(x)->len;
|
||||
if (!i) return INT2FIX(~(SIGNED_VALUE)0);
|
||||
while (i--) ds[i] = ~ds[i];
|
||||
RBIGNUM(z)->sign = !RBIGNUM(z)->sign;
|
||||
if (RBIGNUM(x)->sign) get2comp(z);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue