mirror of
https://github.com/micropython/micropython.git
synced 2026-01-04 19:20:22 +01:00
sequence.c: Start to refactor sequence operations for reuse among types.
This commit is contained in:
@@ -153,13 +153,8 @@ static mp_obj_t list_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) {
|
||||
return NULL;
|
||||
}
|
||||
int n = MP_OBJ_SMALL_INT_VALUE(rhs);
|
||||
int len = o->len;
|
||||
mp_obj_list_t *s = list_new(len * n);
|
||||
mp_obj_t *dest = s->items;
|
||||
for (int i = 0; i < n; i++) {
|
||||
memcpy(dest, o->items, sizeof(mp_obj_t) * len);
|
||||
dest += len;
|
||||
}
|
||||
mp_obj_list_t *s = list_new(o->len * n);
|
||||
mp_seq_multiply(o->items, sizeof(*o->items), o->len, n, s->items);
|
||||
return s;
|
||||
}
|
||||
case RT_COMPARE_OP_EQUAL:
|
||||
|
||||
Reference in New Issue
Block a user