diff options
author | Jakob Kaivo <jkk@ung.org> | 2022-03-28 14:54:40 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2022-03-28 14:54:40 -0400 |
commit | ae94463be87baa4e826cd1e18a8ec94abc0a5a45 (patch) | |
tree | 8969ace83d91256af2a895670306d43cd8441c22 | |
parent | 4b7c6f6e5fab83021e75cb8306b081b4cbc7d3af (diff) |
modernize len()
-rw-r--r-- | big.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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 */ |