[git commit] bc: simplify another for() loop
Denys Vlasenko
vda.linux at googlemail.com
Tue Dec 18 12:15:55 UTC 2018
commit: https://git.busybox.net/busybox/commit/?id=5c0c5abba09c7bab423d1261920d8c73c5eac939
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
function old new delta
zbc_num_d 563 557 -6
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
miscutils/bc.c | 12 ++++++------
1 file 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
More information about the busybox-cvs
mailing list