bc: simplify another for() loop

function                                             old     new   delta
zbc_num_d                                            563     557      -6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2018-12-18 13:15:55 +01:00
parent 6b0fbd14fc
commit 5c0c5abba0

View File

@ -1929,8 +1929,7 @@ err:
static FAST_FUNC BC_STATUS zbc_num_d(BcNum *a, BcNum *b, BcNum *restrict c, size_t scale) static FAST_FUNC BC_STATUS zbc_num_d(BcNum *a, BcNum *b, BcNum *restrict c, size_t scale)
{ {
BcStatus s = BC_STATUS_SUCCESS; BcStatus s;
BcDig *n, *p, q;
size_t len, end, i; size_t len, end, i;
BcNum cp; BcNum cp;
@ -1981,12 +1980,13 @@ static FAST_FUNC BC_STATUS zbc_num_d(BcNum *a, BcNum *b, BcNum *restrict c, size
memset(c->num + end, 0, (c->cap - end) * sizeof(BcDig)); memset(c->num + end, 0, (c->cap - end) * sizeof(BcDig));
c->rdx = cp.rdx; c->rdx = cp.rdx;
c->len = cp.len; c->len = cp.len;
p = b->num;
for (i = end - 1; !s && i < end; --i) { s = BC_STATUS_SUCCESS;
for (i = end - 1; i < end; --i) {
BcDig *n, q;
n = cp.num + i; n = cp.num + i;
for (q = 0; (!s && n[len] != 0) || bc_num_compare(n, p, len) >= 0; ++q) for (q = 0; n[len] != 0 || bc_num_compare(n, b->num, len) >= 0; ++q)
bc_num_subArrays(n, p, len); bc_num_subArrays(n, b->num, len);
c->num[i] = q; c->num[i] = q;
#if ENABLE_FEATURE_BC_SIGNALS #if ENABLE_FEATURE_BC_SIGNALS
// a=2^100000 // a=2^100000