summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolai Stange <nicstange@gmail.com>2016-03-22 13:12:37 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2016-04-05 20:35:48 +0800
commitea122be0b8f788b30e71ed5536fddc05f5ddff86 (patch)
tree2d0080d5655a78108607e78b2d5f150916384aa7
parent654842ef53d7820129a751f5cc620e5a69c694a9 (diff)
lib/mpi: mpi_write_sgl(): purge redundant pointer arithmetic
Within the copying loop in mpi_write_sgl(), we have if (lzeros) { ... p -= lzeros; y = lzeros; } p = p - (sizeof(alimb) - y); If lzeros == 0, then y == 0, too. Thus, lzeros gets subtracted and added back again to p. Purge this redundancy. Signed-off-by: Nicolai Stange <nicstange@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--lib/mpi/mpicoder.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/mpi/mpicoder.c b/lib/mpi/mpicoder.c
index d8b372b9cc11..78ec4e1131b9 100644
--- a/lib/mpi/mpicoder.c
+++ b/lib/mpi/mpicoder.c
@@ -407,12 +407,11 @@ int mpi_write_to_sgl(MPI a, struct scatterlist *sgl, unsigned *nbytes,
mpi_limb_t *limb2 = (void *)p - sizeof(alimb)
+ lzeros;
*limb1 = *limb2;
- p -= lzeros;
y = lzeros;
lzeros = 0;
}
- p = p - (sizeof(alimb) - y);
+ p = p - sizeof(alimb);
for (x = 0; x < sizeof(alimb) - y; x++) {
if (!buf_len) {