summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2022-03-28 14:54:40 -0400
committerJakob Kaivo <jkk@ung.org>2022-03-28 14:54:40 -0400
commitae94463be87baa4e826cd1e18a8ec94abc0a5a45 (patch)
tree8969ace83d91256af2a895670306d43cd8441c22
parent4b7c6f6e5fab83021e75cb8306b081b4cbc7d3af (diff)
modernize len()
-rw-r--r--big.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/big.c b/big.c
index 9f195d3..b438b3b 100644
--- a/big.c
+++ b/big.c
@@ -551,13 +551,15 @@ word longdiv(word x, word y)
}
} /* see Bird & Wadler p82 for explanation */
-word len(x) /* no of digits in big x */
-word x;
+/* no of digits in big x */
+word len(word x)
{
word n = 1;
- while (x = rest(x))
+ while (x = rest(x)) {
n++;
- return (n);
+ }
+
+ return n;
}
word msd(x) /* most significant digit of big x */