diff options
author | Jakob Kaivo <jkk@ung.org> | 2022-03-28 14:00:26 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2022-03-28 14:00:26 -0400 |
commit | c8a72f0312e7260154627183efdede99aa8da25f (patch) | |
tree | 36a46052454d97d04e5097adcdea23f8f71a90de | |
parent | 8a13fcc5633a4c0acbf04662bfdcc61fdb6f756c (diff) |
modernize bignegate()
-rw-r--r-- | big.c | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -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) |