summaryrefslogtreecommitdiffstats
path: root/mpi
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-01-18 20:39:13 -0800
committerKaz Kylheku <kaz@kylheku.com>2019-01-18 20:39:13 -0800
commitc96ba19397d9fbb444d87615d7e7bc9679e05688 (patch)
tree16a429dfd48ff8b61819cf558f36f1bbd9a49d1d /mpi
parentc5ce3d4d4d86a27b0cd0d872a8f98d097d6216a6 (diff)
downloadtxr-c96ba19397d9fbb444d87615d7e7bc9679e05688.tar.gz
txr-c96ba19397d9fbb444d87615d7e7bc9679e05688.tar.bz2
txr-c96ba19397d9fbb444d87615d7e7bc9679e05688.zip
mpi: some params should be mp_size, not mp_digit.
* mpi/mpi.c (s_mp_2expt, mp_trunc_comp, mp_trunc, mp_bit): Arguments that give a number of bits or bit position should be mp_size; they are not related to digit values. * mpi/mpi.h (mp_trunc_comp, mp_trunc, mp_bit): Declaration updated.
Diffstat (limited to 'mpi')
-rw-r--r--mpi/mpi.c12
-rw-r--r--mpi/mpi.h6
2 files changed, 9 insertions, 9 deletions
diff --git a/mpi/mpi.c b/mpi/mpi.c
index 673c29a1..ef91437b 100644
--- a/mpi/mpi.c
+++ b/mpi/mpi.c
@@ -150,7 +150,7 @@ mp_err s_mp_sqr(mp_int *a); /* magnitude square */
#endif
mp_err s_mp_div(mp_int *a, mp_int *b); /* magnitude divide */
-mp_err s_mp_2expt(mp_int *a, mp_digit k); /* a = 2^k */
+mp_err s_mp_2expt(mp_int *a, mp_size k); /* a = 2^k */
int s_mp_cmp(mp_int *a, mp_int *b); /* magnitude comparison */
int s_mp_cmp_d(mp_int *a, mp_digit d); /* magnitude digit compare */
mp_size s_mp_ispow2(mp_int *v); /* is v a power of 2? */
@@ -2139,7 +2139,7 @@ mp_err mp_comp(mp_int *a, mp_int *b)
return MP_OKAY;
}
-mp_err mp_trunc_comp(mp_int *a, mp_int *b, mp_digit bits)
+mp_err mp_trunc_comp(mp_int *a, mp_int *b, mp_size bits)
{
mp_err res;
mp_size ix, dig = bits / DIGIT_BIT, rembits = bits % DIGIT_BIT;
@@ -2182,7 +2182,7 @@ mp_err mp_trunc_comp(mp_int *a, mp_int *b, mp_digit bits)
return MP_OKAY;
}
-mp_err mp_trunc(mp_int *a, mp_int *b, mp_digit bits)
+mp_err mp_trunc(mp_int *a, mp_int *b, mp_size bits)
{
mp_err res;
mp_size ix, dig = bits / DIGIT_BIT, rembits = bits % DIGIT_BIT;
@@ -2276,12 +2276,12 @@ mp_err mp_shift(mp_int *a, mp_int *b, int bits)
return MP_OKAY;
}
-mp_err mp_bit(mp_int *a, mp_digit bit)
+mp_err mp_bit(mp_int *a, mp_size bit)
{
mp_int tmp;
mp_err res;
int a_neg = ISNEG(a);
- mp_digit digit = bit / MP_DIGIT_BIT;
+ mp_size digit = bit / MP_DIGIT_BIT;
mp_digit mask = convert(mp_digit, 1) << (bit % MP_DIGIT_BIT);
if (a_neg) {
@@ -3799,7 +3799,7 @@ T:
return res;
}
-mp_err s_mp_2expt(mp_int *a, mp_digit k)
+mp_err s_mp_2expt(mp_int *a, mp_size k)
{
mp_err res;
mp_size dig, bit;
diff --git a/mpi/mpi.h b/mpi/mpi.h
index c1b50296..0fd9b740 100644
--- a/mpi/mpi.h
+++ b/mpi/mpi.h
@@ -153,10 +153,10 @@ mp_err mp_and(mp_int *a, mp_int *b, mp_int *c);
mp_err mp_or(mp_int *a, mp_int *b, mp_int *c);
mp_err mp_xor(mp_int *a, mp_int *b, mp_int *c);
mp_err mp_comp(mp_int *a, mp_int *b);
-mp_nign mp_err mp_trunc_comp(mp_int *a, mp_int *b, mp_digit bits);
-mp_nign mp_err mp_trunc(mp_int *a, mp_int *b, mp_digit bits);
+mp_nign mp_err mp_trunc_comp(mp_int *a, mp_int *b, mp_size bits);
+mp_nign mp_err mp_trunc(mp_int *a, mp_int *b, mp_size bits);
mp_nign mp_err mp_shift(mp_int *a, mp_int *b, int bits); /* + left, - right */
-mp_err mp_bit(mp_int *a, mp_digit bit);
+mp_err mp_bit(mp_int *a, mp_size bit);
mp_nign mp_err mp_to_double(mp_int *mp, double *d);