diff options
author | Denys Vlasenko | 2018-12-19 17:59:30 +0100 |
---|---|---|
committer | Denys Vlasenko | 2018-12-19 17:59:30 +0100 |
commit | eac0de55d69a4eea87689c1d4800eb8e80824aca (patch) | |
tree | f5262f97e846088a221738f7087b27c9081742e7 /miscutils | |
parent | 87888ce4d826a117bac89fe3475a8ae859a6e42a (diff) | |
download | busybox-eac0de55d69a4eea87689c1d4800eb8e80824aca.zip busybox-eac0de55d69a4eea87689c1d4800eb8e80824aca.tar.gz |
bc: avoid bc_vec_item() calls in bc_array_copy()
function old new delta
zbc_program_copyToVar 311 300 -11
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/bc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index 8316933..01442c3 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c @@ -2572,14 +2572,16 @@ static void bc_array_expand(BcVec *a, size_t len) static void bc_array_copy(BcVec *d, const BcVec *s) { + BcNum *dnum, *snum; size_t i; bc_vec_pop_all(d); bc_vec_expand(d, s->cap); d->len = s->len; - for (i = 0; i < s->len; ++i) { - BcNum *dnum = bc_vec_item(d, i), *snum = bc_vec_item(s, i); + dnum = (void*)d->v; + snum = (void*)s->v; + for (i = 0; i < s->len; i++, dnum++, snum++) { bc_num_init(dnum, snum->len); bc_num_copy(dnum, snum); } |