[PATCH 1/1 linux-next] lib/mpi: use swap() in mpi_powm()

From: Fabian Frederick
Date: Fri Jun 12 2015 - 12:59:33 EST


Use kernel.h macro definition.

Thanks to Julia Lawall for Coccinelle scripting support.

Signed-off-by: Fabian Frederick <fabf@xxxxxxxxx>
---
lib/mpi/mpi-pow.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/lib/mpi/mpi-pow.c b/lib/mpi/mpi-pow.c
index 5464c87..1acebfe 100644
--- a/lib/mpi/mpi-pow.c
+++ b/lib/mpi/mpi-pow.c
@@ -185,7 +185,6 @@ int mpi_powm(MPI res, MPI base, MPI exp, MPI mod)

for (;;) {
while (c) {
- mpi_ptr_t tp;
mpi_size_t xsize;

/*if (mpihelp_mul_n(xp, rp, rp, rsize) < 0) goto enomem */
@@ -216,9 +215,7 @@ int mpi_powm(MPI res, MPI base, MPI exp, MPI mod)
xsize = msize;
}

- tp = rp;
- rp = xp;
- xp = tp;
+ swap(rp, xp);
rsize = xsize;

if ((mpi_limb_signed_t) e < 0) {
@@ -244,9 +241,7 @@ int mpi_powm(MPI res, MPI base, MPI exp, MPI mod)
xsize = msize;
}

- tp = rp;
- rp = xp;
- xp = tp;
+ swap(rp, xp);
rsize = xsize;
}
e <<= 1;
--
2.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/