aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-12-18 13:15:55 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-12-18 13:15:55 +0100
commit5c0c5abba09c7bab423d1261920d8c73c5eac939 (patch)
tree1130ba9f083d423edf1e3b9765c0e0aa5f7e99c2
parent6b0fbd14fc0566a4f6cedf50f6301143e74adca5 (diff)
downloadbusybox-5c0c5abba09c7bab423d1261920d8c73c5eac939.tar.gz
bc: simplify another for() loop
function old new delta zbc_num_d 563 557 -6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--miscutils/bc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c
index 927873d86..4b5cac08a 100644
--- a/miscutils/bc.c
+++ b/miscutils/bc.c
@@ -1929,8 +1929,7 @@ err:
static FAST_FUNC BC_STATUS zbc_num_d(BcNum *a, BcNum *b, BcNum *restrict c, size_t scale)
{
- BcStatus s = BC_STATUS_SUCCESS;
- BcDig *n, *p, q;
+ BcStatus s;
size_t len, end, i;
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));
c->rdx = cp.rdx;
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;
- for (q = 0; (!s && n[len] != 0) || bc_num_compare(n, p, len) >= 0; ++q)
- bc_num_subArrays(n, p, len);
+ for (q = 0; n[len] != 0 || bc_num_compare(n, b->num, len) >= 0; ++q)
+ bc_num_subArrays(n, b->num, len);
c->num[i] = q;
#if ENABLE_FEATURE_BC_SIGNALS
// a=2^100000