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>
This commit is contained in:
parent
87888ce4d8
commit
eac0de55d6
@ -2572,14 +2572,16 @@ static void bc_array_expand(BcVec *a, size_t len)
|
|||||||
|
|
||||||
static void bc_array_copy(BcVec *d, const BcVec *s)
|
static void bc_array_copy(BcVec *d, const BcVec *s)
|
||||||
{
|
{
|
||||||
|
BcNum *dnum, *snum;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
bc_vec_pop_all(d);
|
bc_vec_pop_all(d);
|
||||||
bc_vec_expand(d, s->cap);
|
bc_vec_expand(d, s->cap);
|
||||||
d->len = s->len;
|
d->len = s->len;
|
||||||
|
|
||||||
for (i = 0; i < s->len; ++i) {
|
dnum = (void*)d->v;
|
||||||
BcNum *dnum = bc_vec_item(d, i), *snum = bc_vec_item(s, i);
|
snum = (void*)s->v;
|
||||||
|
for (i = 0; i < s->len; i++, dnum++, snum++) {
|
||||||
bc_num_init(dnum, snum->len);
|
bc_num_init(dnum, snum->len);
|
||||||
bc_num_copy(dnum, snum);
|
bc_num_copy(dnum, snum);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user