summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2022-03-28 14:34:30 -0400
committerJakob Kaivo <jkk@ung.org>2022-03-28 14:34:30 -0400
commit00fa74c7c906a1a21b703834c4c73b28777fe2e3 (patch)
tree729c353a9b13c1e7789efdf03d15b5514ca9ca91
parenta624e05d31c367d90c3fa8015bb1e12d3d1c2e45 (diff)
modernize shift()
-rw-r--r--big.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/big.c b/big.c
index 78049eb..2a640e5 100644
--- a/big.c
+++ b/big.c
@@ -313,7 +313,6 @@ word bigtimes(word x, word y)
return (r);
}
- //word d = digit0(y);
word s = big_is_negative(y);
for (word n = 0, d = digit0(y); y; n++, d = digit(y)) {
if (d) {
@@ -321,18 +320,19 @@ word bigtimes(word x, word y)
}
y = rest(y);
- //d = digit(y);
}
return (s != big_is_negative(x) ? bignegate(r) : r);
}
-word shift(n, x) /* multiply big x by n'th power of IBASE */
-word n, x;
+/* multiply big x by n'th power of IBASE */
+word shift(word n, word x)
{
- while (n--)
+ while (n--) {
x = make(INT, 0, x);
- return (x);
-} /* NB - we assume x non-zero, else unnormalised result */
+ }
+
+ return x;
+}
word stimes(x, n) /* multiply big x (>=0) by digit n (>0) */
word x, n;