55 .
name = MP_QSTR_iterator,
85 if (self->step == 1) {
118 mp_int_t len =
self->stop -
self->start +
self->step;
119 if (self->step > 0) {
124 len = len /
self->step;
146 #if MICROPY_PY_BUILTINS_SLICE 149 mp_seq_get_fast_slice_indexes(len, index, &slice);
152 o->
start =
self->start + slice.
start *
self->step;
153 o->
stop =
self->start + slice.
stop *
self->step;
155 if (slice.
step < 0) {
157 o->
stop -=
self->step;
162 size_t index_val =
mp_get_index(self->base.type, len, index,
false);
175 #if MICROPY_PY_BUILTINS_RANGE_ATTRS 182 if (
attr == MP_QSTR_start) {
184 }
else if (
attr == MP_QSTR_stop) {
186 }
else if (
attr == MP_QSTR_step) {
194 .
name = MP_QSTR_range,
200 #if MICROPY_PY_BUILTINS_RANGE_ATTRS
STATIC mp_obj_t range_it_iternext(mp_obj_t o_in)
STATIC mp_obj_t range_getiter(mp_obj_t o_in, mp_obj_iter_buf_t *iter_buf)
#define MP_OBJ_IS_TYPE(o, t)
STATIC const uint8_t attr[]
STATIC const mp_obj_type_t range_it_type
int mp_print_str(const mp_print_t *print, const char *str)
#define MP_OBJ_FROM_PTR(p)
void mp_arg_check_num(size_t n_args, size_t n_kw, size_t n_args_min, size_t n_args_max, bool takes_kw)
mp_int_t mp_obj_get_int(mp_const_obj_t arg)
STATIC mp_obj_t range_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value)
STATIC mp_obj_t mp_obj_new_range_iterator(mp_int_t cur, mp_int_t stop, mp_int_t step, mp_obj_iter_buf_t *iter_buf)
size_t mp_get_index(const mp_obj_type_t *type, size_t len, mp_obj_t index, bool is_slice)
#define MP_OBJ_NEW_SMALL_INT(small_int)
STATIC mp_obj_t range_unary_op(mp_unary_op_t op, mp_obj_t self_in)
mp_obj_t mp_obj_new_int(mp_int_t value)
struct _mp_obj_range_it_t mp_obj_range_it_t
const mp_obj_type_t mp_type_type
const mp_obj_type_t mp_type_range
NORETURN void mp_raise_ValueError(const char *msg)
mp_obj_t mp_identity_getiter(mp_obj_t self, mp_obj_iter_buf_t *iter_buf)
const mp_obj_type_t mp_type_slice
struct _mp_obj_range_t mp_obj_range_t
STATIC void range_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind)
STATIC mp_int_t range_len(mp_obj_range_t *self)
#define MP_OBJ_STOP_ITERATION
int mp_printf(const mp_print_t *print, const char *fmt,...)
STATIC mp_obj_t range_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args)