summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2022-03-28 14:02:54 -0400
committerJakob Kaivo <jkk@ung.org>2022-03-28 14:02:54 -0400
commit6831094e2b4d9918b32741c7509416495142ae61 (patch)
tree4b8cefa7694d2dbd43732d562b8a6c2273ec2eb1
parentc8a72f0312e7260154627183efdede99aa8da25f (diff)
modernize bigplus()
-rw-r--r--big.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/big.c b/big.c
index d1cff5f..919390d 100644
--- a/big.c
+++ b/big.c
@@ -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;
{