From c8a72f0312e7260154627183efdede99aa8da25f Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Mon, 28 Mar 2022 14:00:26 -0400 Subject: modernize bignegate() --- big.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'big.c') diff --git a/big.c b/big.c index 022b49d..d1cff5f 100644 --- a/big.c +++ b/big.c @@ -88,13 +88,16 @@ long long get_int(word x) return (sign ? -n : n); } -word bignegate(x) -word x; +word bignegate(word x) { - if (bigzero(x)) - return (x); - return (make - (INT, hd[x] & SIGNBIT ? hd[x] & MAXDIGIT : SIGNBIT | hd[x], tl[x])); + if (bigzero(x)) { + return x; + } + + if (hd[x] & SIGNBIT) { + return make(INT, hd[x] & MAXDIGIT, tl[x]); + } + return make(INT, SIGNBIT | hd[x], tl[x]); } word bigplus(x, y) -- cgit v1.2.1