diff options
Diffstat (limited to 'bignum.c')
-rw-r--r-- | bignum.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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); |