提交 654842ef 编写于 作者: N Nicolai Stange 提交者: Herbert Xu

lib/mpi: mpi_write_sgl(): fix style issue with lzero decrement

Within the copying loop in mpi_write_sgl(), we have

  if (lzeros > 0) {
    ...
    lzeros -= sizeof(alimb);
  }

However, at this point, lzeros < sizeof(alimb) holds. Make this fact
explicit by rewriting the above to

  if (lzeros) {
    ...
    lzeros = 0;
  }
Signed-off-by: NNicolai Stange <nicstange@gmail.com>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 f2d1362f
...@@ -402,14 +402,14 @@ int mpi_write_to_sgl(MPI a, struct scatterlist *sgl, unsigned *nbytes, ...@@ -402,14 +402,14 @@ int mpi_write_to_sgl(MPI a, struct scatterlist *sgl, unsigned *nbytes,
#else #else
#error please implement for this limb size. #error please implement for this limb size.
#endif #endif
if (lzeros > 0) { if (lzeros) {
mpi_limb_t *limb1 = (void *)p - sizeof(alimb); mpi_limb_t *limb1 = (void *)p - sizeof(alimb);
mpi_limb_t *limb2 = (void *)p - sizeof(alimb) mpi_limb_t *limb2 = (void *)p - sizeof(alimb)
+ lzeros; + lzeros;
*limb1 = *limb2; *limb1 = *limb2;
p -= lzeros; p -= lzeros;
y = lzeros; y = lzeros;
lzeros -= sizeof(alimb); lzeros = 0;
} }
p = p - (sizeof(alimb) - y); p = p - (sizeof(alimb) - y);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册