Skip to content

Commit 9bc56d9

Browse files
committed
Changed to use memcpy.
1 parent aeb16c3 commit 9bc56d9

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

py/objlist.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,8 @@ static mp_obj_t list_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) {
5151
}
5252
mp_obj_list_t *p = rhs;
5353
mp_obj_list_t *s = list_new(o->len + p->len);
54-
for (int i = 0; i < o->len; i++) {
55-
s->items[i] = o->items[i];
56-
}
57-
for (int i = 0; i < p->len; i++) {
58-
s->items[i + o->len] = p->items[i];
59-
}
54+
memcpy(s->items, o->items, sizeof(mp_obj_t) * o->len);
55+
memcpy(s->items + o->len, p->items, sizeof(mp_obj_t) * p->len);
6056
return s;
6157
}
6258
default:

0 commit comments

Comments
 (0)