Commit ae6ee6ae authored by Herbert Xu's avatar Herbert Xu

lib/mpi: Fix unused variable warnings

This patch removes a number of unused variables and marks others
as unused in order to silence compiler warnings about them.

Fixes: a8ea8bdd ("lib/mpi: Extend the MPI library")
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Tested-by: default avatarTianjia Zhang <tianjia.zhang@linux.alibaba.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 4a0c1de6
...@@ -92,7 +92,6 @@ void mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den) ...@@ -92,7 +92,6 @@ void mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den)
unsigned int normalization_steps; unsigned int normalization_steps;
mpi_limb_t q_limb; mpi_limb_t q_limb;
mpi_ptr_t marker[5]; mpi_ptr_t marker[5];
unsigned int marker_nlimbs[5];
int markidx = 0; int markidx = 0;
/* Ensure space is enough for quotient and remainder. /* Ensure space is enough for quotient and remainder.
...@@ -152,7 +151,6 @@ void mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den) ...@@ -152,7 +151,6 @@ void mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den)
* numerator would be gradually overwritten by the quotient limbs. * numerator would be gradually overwritten by the quotient limbs.
*/ */
if (qp == np) { /* Copy NP object to temporary space. */ if (qp == np) { /* Copy NP object to temporary space. */
marker_nlimbs[markidx] = nsize;
np = marker[markidx++] = mpi_alloc_limb_space(nsize); np = marker[markidx++] = mpi_alloc_limb_space(nsize);
MPN_COPY(np, qp, nsize); MPN_COPY(np, qp, nsize);
} }
...@@ -173,7 +171,6 @@ void mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den) ...@@ -173,7 +171,6 @@ void mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den)
* the most significant word. Use temporary storage not to clobber * the most significant word. Use temporary storage not to clobber
* the original contents of the denominator. * the original contents of the denominator.
*/ */
marker_nlimbs[markidx] = dsize;
tp = marker[markidx++] = mpi_alloc_limb_space(dsize); tp = marker[markidx++] = mpi_alloc_limb_space(dsize);
mpihelp_lshift(tp, dp, dsize, normalization_steps); mpihelp_lshift(tp, dp, dsize, normalization_steps);
dp = tp; dp = tp;
...@@ -195,7 +192,6 @@ void mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den) ...@@ -195,7 +192,6 @@ void mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den)
if (dp == rp || (quot && (dp == qp))) { if (dp == rp || (quot && (dp == qp))) {
mpi_ptr_t tp; mpi_ptr_t tp;
marker_nlimbs[markidx] = dsize;
tp = marker[markidx++] = mpi_alloc_limb_space(dsize); tp = marker[markidx++] = mpi_alloc_limb_space(dsize);
MPN_COPY(tp, dp, dsize); MPN_COPY(tp, dp, dsize);
dp = tp; dp = tp;
......
...@@ -114,7 +114,7 @@ typedef int mpi_size_t; /* (must be a signed type) */ ...@@ -114,7 +114,7 @@ typedef int mpi_size_t; /* (must be a signed type) */
*/ */
#define UDIV_QRNND_PREINV(q, r, nh, nl, d, di) \ #define UDIV_QRNND_PREINV(q, r, nh, nl, d, di) \
do { \ do { \
mpi_limb_t _ql; \ mpi_limb_t _ql __maybe_unused; \
mpi_limb_t _q, _r; \ mpi_limb_t _q, _r; \
mpi_limb_t _xh, _xl; \ mpi_limb_t _xh, _xl; \
umul_ppmm(_q, _ql, (nh), (di)); \ umul_ppmm(_q, _ql, (nh), (di)); \
......
...@@ -21,7 +21,6 @@ void mpi_mul(MPI w, MPI u, MPI v) ...@@ -21,7 +21,6 @@ void mpi_mul(MPI w, MPI u, MPI v)
int usign, vsign, sign_product; int usign, vsign, sign_product;
int assign_wp = 0; int assign_wp = 0;
mpi_ptr_t tmp_limb = NULL; mpi_ptr_t tmp_limb = NULL;
unsigned int tmp_limb_nlimbs = 0;
if (u->nlimbs < v->nlimbs) { if (u->nlimbs < v->nlimbs) {
/* Swap U and V. */ /* Swap U and V. */
...@@ -55,7 +54,6 @@ void mpi_mul(MPI w, MPI u, MPI v) ...@@ -55,7 +54,6 @@ void mpi_mul(MPI w, MPI u, MPI v)
} else { /* Make U and V not overlap with W. */ } else { /* Make U and V not overlap with W. */
if (wp == up) { if (wp == up) {
/* W and U are identical. Allocate temporary space for U. */ /* W and U are identical. Allocate temporary space for U. */
tmp_limb_nlimbs = usize;
up = tmp_limb = mpi_alloc_limb_space(usize); up = tmp_limb = mpi_alloc_limb_space(usize);
/* Is V identical too? Keep it identical with U. */ /* Is V identical too? Keep it identical with U. */
if (wp == vp) if (wp == vp)
...@@ -64,7 +62,6 @@ void mpi_mul(MPI w, MPI u, MPI v) ...@@ -64,7 +62,6 @@ void mpi_mul(MPI w, MPI u, MPI v)
MPN_COPY(up, wp, usize); MPN_COPY(up, wp, usize);
} else if (wp == vp) { } else if (wp == vp) {
/* W and V are identical. Allocate temporary space for V. */ /* W and V are identical. Allocate temporary space for V. */
tmp_limb_nlimbs = vsize;
vp = tmp_limb = mpi_alloc_limb_space(vsize); vp = tmp_limb = mpi_alloc_limb_space(vsize);
/* Copy to the temporary space. */ /* Copy to the temporary space. */
MPN_COPY(vp, wp, vsize); MPN_COPY(vp, wp, vsize);
......
...@@ -31,7 +31,7 @@ mpihelp_mod_1(mpi_ptr_t dividend_ptr, mpi_size_t dividend_size, ...@@ -31,7 +31,7 @@ mpihelp_mod_1(mpi_ptr_t dividend_ptr, mpi_size_t dividend_size,
{ {
mpi_size_t i; mpi_size_t i;
mpi_limb_t n1, n0, r; mpi_limb_t n1, n0, r;
mpi_limb_t dummy; mpi_limb_t dummy __maybe_unused;
/* Botch: Should this be handled at all? Rely on callers? */ /* Botch: Should this be handled at all? Rely on callers? */
if (!dividend_size) if (!dividend_size)
...@@ -382,7 +382,7 @@ mpihelp_divmod_1(mpi_ptr_t quot_ptr, ...@@ -382,7 +382,7 @@ mpihelp_divmod_1(mpi_ptr_t quot_ptr,
{ {
mpi_size_t i; mpi_size_t i;
mpi_limb_t n1, n0, r; mpi_limb_t n1, n0, r;
mpi_limb_t dummy; mpi_limb_t dummy __maybe_unused;
if (!dividend_size) if (!dividend_size)
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment