diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-01-21 00:19:19 +0200 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-01-21 00:39:12 +0200 |
commit | 439542f70c4546568dca3f2539d503aa7a6ec05b (patch) | |
tree | 44d8ad003c5382567ca64aed25556c99ce05a2fe /py/objlist.c | |
parent | 51ee44a718668964f2986096b3cb5ac45fb85439 (diff) | |
download | micropython-439542f70c4546568dca3f2539d503aa7a6ec05b.tar.gz micropython-439542f70c4546568dca3f2539d503aa7a6ec05b.zip |
sequence.c: Start to refactor sequence operations for reuse among types.
Diffstat (limited to 'py/objlist.c')
-rw-r--r-- | py/objlist.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/py/objlist.c b/py/objlist.c index 0ad7b68799..8043842227 100644 --- a/py/objlist.c +++ b/py/objlist.c @@ -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: |