diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-01-18 20:39:13 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-01-18 20:39:13 -0800 |
commit | c96ba19397d9fbb444d87615d7e7bc9679e05688 (patch) | |
tree | 16a429dfd48ff8b61819cf558f36f1bbd9a49d1d /mpi | |
parent | c5ce3d4d4d86a27b0cd0d872a8f98d097d6216a6 (diff) | |
download | txr-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.c | 12 | ||||
-rw-r--r-- | mpi/mpi.h | 6 |
2 files changed, 9 insertions, 9 deletions
@@ -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; @@ -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); |