summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--big.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/big.c b/big.c
index b438b3b..02753f6 100644
--- a/big.c
+++ b/big.c
@@ -562,21 +562,26 @@ word len(word x)
return n;
}
-word msd(x) /* most significant digit of big x */
-word x;
+/* most significant digit of big x */
+word msd(word x)
{
- while (rest(x))
+ while (rest(x)) {
x = rest(x);
- return (digit(x)); /* sign? */
+ }
+
+ return digit(x); /* sign? */
}
-word ms2d(x) /* most significant 2 digits of big x (len>=2) */
-word x;
+/* most significant 2 digits of big x (len>=2) */
+word ms2d(word x)
{
word d = digit(x);
x = rest(x);
- while (rest(x))
- d = digit(x), x = rest(x);
+ while (rest(x)) {
+ d = digit(x);
+ x = rest(x);
+ }
+
return (digit(x) * IBASE + d);
}