diff options
Diffstat (limited to 'py/objtuple.c')
-rw-r--r-- | py/objtuple.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/py/objtuple.c b/py/objtuple.c index c547da9406..1935a67098 100644 --- a/py/objtuple.c +++ b/py/objtuple.c @@ -32,7 +32,7 @@ #include "py/runtime0.h" #include "py/runtime.h" -STATIC mp_obj_t mp_obj_new_tuple_iterator(mp_obj_tuple_t *tuple, mp_uint_t cur); +STATIC mp_obj_t mp_obj_new_tuple_iterator(mp_obj_tuple_t *tuple, size_t cur); /******************************************************************************/ /* tuple */ @@ -45,7 +45,7 @@ void mp_obj_tuple_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t mp_print_str(print, "("); kind = PRINT_REPR; } - for (mp_uint_t i = 0; i < o->len; i++) { + for (size_t i = 0; i < o->len; i++) { if (i > 0) { mp_print_str(print, ", "); } @@ -80,8 +80,8 @@ STATIC mp_obj_t mp_obj_tuple_make_new(const mp_obj_type_t *type_in, size_t n_arg // TODO optimise for cases where we know the length of the iterator - mp_uint_t alloc = 4; - mp_uint_t len = 0; + size_t alloc = 4; + size_t len = 0; mp_obj_t *items = m_new(mp_obj_t, alloc); mp_obj_t iterable = mp_getiter(args[0]); @@ -127,7 +127,7 @@ mp_obj_t mp_obj_tuple_unary_op(mp_uint_t op, mp_obj_t self_in) { case MP_UNARY_OP_HASH: { // start hash with pointer to empty tuple, to make it fairly unique mp_int_t hash = (mp_int_t)mp_const_empty_tuple; - for (mp_uint_t i = 0; i < self->len; i++) { + for (size_t i = 0; i < self->len; i++) { hash += MP_OBJ_SMALL_INT_VALUE(mp_unary_op(MP_UNARY_OP_HASH, self->items[i])); } return MP_OBJ_NEW_SMALL_INT(hash); @@ -235,7 +235,7 @@ const mp_obj_type_t mp_type_tuple = { // the zero-length tuple const mp_obj_tuple_t mp_const_empty_tuple_obj = {{&mp_type_tuple}, 0}; -mp_obj_t mp_obj_new_tuple(mp_uint_t n, const mp_obj_t *items) { +mp_obj_t mp_obj_new_tuple(size_t n, const mp_obj_t *items) { if (n == 0) { return mp_const_empty_tuple; } @@ -243,7 +243,7 @@ mp_obj_t mp_obj_new_tuple(mp_uint_t n, const mp_obj_t *items) { o->base.type = &mp_type_tuple; o->len = n; if (items) { - for (mp_uint_t i = 0; i < n; i++) { + for (size_t i = 0; i < n; i++) { o->items[i] = items[i]; } } @@ -270,7 +270,7 @@ typedef struct _mp_obj_tuple_it_t { mp_obj_base_t base; mp_fun_1_t iternext; mp_obj_tuple_t *tuple; - mp_uint_t cur; + size_t cur; } mp_obj_tuple_it_t; STATIC mp_obj_t tuple_it_iternext(mp_obj_t self_in) { @@ -284,7 +284,7 @@ STATIC mp_obj_t tuple_it_iternext(mp_obj_t self_in) { } } -STATIC mp_obj_t mp_obj_new_tuple_iterator(mp_obj_tuple_t *tuple, mp_uint_t cur) { +STATIC mp_obj_t mp_obj_new_tuple_iterator(mp_obj_tuple_t *tuple, size_t cur) { mp_obj_tuple_it_t *o = m_new_obj(mp_obj_tuple_it_t); o->base.type = &mp_type_polymorph_iter; o->iternext = tuple_it_iternext; |