diff options
author | Jakob Kaivo <jkk@ung.org> | 2022-03-28 14:02:54 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2022-03-28 14:02:54 -0400 |
commit | 6831094e2b4d9918b32741c7509416495142ae61 (patch) | |
tree | 4b8cefa7694d2dbd43732d562b8a6c2273ec2eb1 /big.c | |
parent | c8a72f0312e7260154627183efdede99aa8da25f (diff) |
modernize bigplus()
Diffstat (limited to 'big.c')
-rw-r--r-- | big.c | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -100,21 +100,24 @@ word bignegate(word x) return make(INT, SIGNBIT | hd[x], tl[x]); } -word bigplus(x, y) -word x, y; +word bigplus(word x, word y) { - if (big_is_positive(x)) - if (big_is_positive(y)) + if (big_is_positive(x)) { + if (big_is_positive(y)) { return (big_plus(x, y, 0)); - else - return (big_sub(x, y)); - else if (big_is_positive(y)) + } + return (big_sub(x, y)); + } + + if (big_is_positive(y)) { return (big_sub(y, x)); - else - return (big_plus(x, y, SIGNBIT)); /* both negative */ + } + + return (big_plus(x, y, SIGNBIT)); /* both negative */ } -word big_plus(x, y, signbit) /* ignore input signs, treat x,y as positive */ +/* ignore input signs, treat x,y as positive */ +word big_plus(x, y, signbit) word x, y; int signbit; { |