Skip to content

Commit d182b98

Browse files
committed
py: Change all uint to mp_uint_t in obj.h.
Part of code cleanup, working towards resolving issue adafruit#50.
1 parent 9c4cbe2 commit d182b98

17 files changed

+71
-96
lines changed

py/builtin.c

Lines changed: 14 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
// args[0] is function from class body
4747
// args[1] is class name
4848
// args[2:] are base objects
49-
STATIC mp_obj_t mp_builtin___build_class__(uint n_args, const mp_obj_t *args) {
49+
STATIC mp_obj_t mp_builtin___build_class__(mp_uint_t n_args, const mp_obj_t *args) {
5050
assert(2 <= n_args);
5151

5252
// set the new classes __locals__ object
@@ -86,7 +86,6 @@ STATIC mp_obj_t mp_builtin___build_class__(uint n_args, const mp_obj_t *args) {
8686

8787
return new_class;
8888
}
89-
9089
MP_DEFINE_CONST_FUN_OBJ_VAR(mp_builtin___build_class___obj, 2, mp_builtin___build_class__);
9190

9291
STATIC mp_obj_t mp_builtin___repl_print__(mp_obj_t o) {
@@ -96,7 +95,6 @@ STATIC mp_obj_t mp_builtin___repl_print__(mp_obj_t o) {
9695
}
9796
return mp_const_none;
9897
}
99-
10098
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin___repl_print___obj, mp_builtin___repl_print__);
10199

102100
STATIC mp_obj_t mp_builtin_abs(mp_obj_t o_in) {
@@ -127,7 +125,6 @@ STATIC mp_obj_t mp_builtin_abs(mp_obj_t o_in) {
127125
return mp_const_none;
128126
}
129127
}
130-
131128
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_abs_obj, mp_builtin_abs);
132129

133130
STATIC mp_obj_t mp_builtin_all(mp_obj_t o_in) {
@@ -140,7 +137,6 @@ STATIC mp_obj_t mp_builtin_all(mp_obj_t o_in) {
140137
}
141138
return mp_const_true;
142139
}
143-
144140
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_all_obj, mp_builtin_all);
145141

146142
STATIC mp_obj_t mp_builtin_any(mp_obj_t o_in) {
@@ -153,14 +149,12 @@ STATIC mp_obj_t mp_builtin_any(mp_obj_t o_in) {
153149
}
154150
return mp_const_false;
155151
}
156-
157152
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_any_obj, mp_builtin_any);
158153

159154
STATIC mp_obj_t mp_builtin_bin(mp_obj_t o_in) {
160155
mp_obj_t args[] = { MP_OBJ_NEW_QSTR(MP_QSTR__brace_open__colon__hash_b_brace_close_), o_in };
161156
return mp_obj_str_format(MP_ARRAY_SIZE(args), args);
162157
}
163-
164158
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_bin_obj, mp_builtin_bin);
165159

166160
STATIC mp_obj_t mp_builtin_callable(mp_obj_t o_in) {
@@ -170,7 +164,6 @@ STATIC mp_obj_t mp_builtin_callable(mp_obj_t o_in) {
170164
return mp_const_false;
171165
}
172166
}
173-
174167
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_callable_obj, mp_builtin_callable);
175168

176169
STATIC mp_obj_t mp_builtin_chr(mp_obj_t o_in) {
@@ -209,10 +202,9 @@ STATIC mp_obj_t mp_builtin_chr(mp_obj_t o_in) {
209202
}
210203
#endif
211204
}
212-
213205
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_chr_obj, mp_builtin_chr);
214206

215-
STATIC mp_obj_t mp_builtin_dir(uint n_args, const mp_obj_t *args) {
207+
STATIC mp_obj_t mp_builtin_dir(mp_uint_t n_args, const mp_obj_t *args) {
216208
// TODO make this function more general and less of a hack
217209

218210
mp_obj_dict_t *dict = NULL;
@@ -238,7 +230,7 @@ STATIC mp_obj_t mp_builtin_dir(uint n_args, const mp_obj_t *args) {
238230

239231
mp_obj_t dir = mp_obj_new_list(0, NULL);
240232
if (dict != NULL) {
241-
for (uint i = 0; i < dict->map.alloc; i++) {
233+
for (mp_uint_t i = 0; i < dict->map.alloc; i++) {
242234
if (MP_MAP_SLOT_IS_FILLED(&dict->map, i)) {
243235
mp_obj_list_append(dir, dict->map.table[i].key);
244236
}
@@ -247,7 +239,6 @@ STATIC mp_obj_t mp_builtin_dir(uint n_args, const mp_obj_t *args) {
247239

248240
return dir;
249241
}
250-
251242
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_dir_obj, 0, 1, mp_builtin_dir);
252243

253244
STATIC mp_obj_t mp_builtin_divmod(mp_obj_t o1_in, mp_obj_t o2_in) {
@@ -262,29 +253,25 @@ STATIC mp_obj_t mp_builtin_divmod(mp_obj_t o1_in, mp_obj_t o2_in) {
262253
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "unsupported operand type(s) for divmod(): '%s' and '%s'", mp_obj_get_type_str(o1_in), mp_obj_get_type_str(o2_in)));
263254
}
264255
}
265-
266256
MP_DEFINE_CONST_FUN_OBJ_2(mp_builtin_divmod_obj, mp_builtin_divmod);
267257

268258
STATIC mp_obj_t mp_builtin_hash(mp_obj_t o_in) {
269259
// TODO hash will generally overflow small integer; can we safely truncate it?
270260
return mp_obj_new_int(mp_obj_hash(o_in));
271261
}
272-
273262
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_hash_obj, mp_builtin_hash);
274263

275264
STATIC mp_obj_t mp_builtin_hex(mp_obj_t o_in) {
276265
return mp_binary_op(MP_BINARY_OP_MODULO, MP_OBJ_NEW_QSTR(MP_QSTR__percent__hash_x), o_in);
277266
}
278-
279267
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_hex_obj, mp_builtin_hex);
280268

281269
STATIC mp_obj_t mp_builtin_iter(mp_obj_t o_in) {
282270
return mp_getiter(o_in);
283271
}
284-
285272
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_iter_obj, mp_builtin_iter);
286273

287-
STATIC mp_obj_t mp_builtin_min_max(uint n_args, const mp_obj_t *args, mp_map_t *kwargs, int op) {
274+
STATIC mp_obj_t mp_builtin_min_max(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs, mp_uint_t op) {
288275
mp_map_elem_t *key_elem = mp_map_lookup(kwargs, MP_OBJ_NEW_QSTR(MP_QSTR_key), MP_MAP_LOOKUP);
289276
mp_obj_t key_fn = key_elem == NULL ? MP_OBJ_NULL : key_elem->value;
290277
if (n_args == 1) {
@@ -319,12 +306,12 @@ STATIC mp_obj_t mp_builtin_min_max(uint n_args, const mp_obj_t *args, mp_map_t *
319306
}
320307
}
321308

322-
STATIC mp_obj_t mp_builtin_max(uint n_args, const mp_obj_t *args, mp_map_t *kwargs) {
309+
STATIC mp_obj_t mp_builtin_max(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
323310
return mp_builtin_min_max(n_args, args, kwargs, MP_BINARY_OP_MORE);
324311
}
325312
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_max_obj, 1, mp_builtin_max);
326313

327-
STATIC mp_obj_t mp_builtin_min(uint n_args, const mp_obj_t *args, mp_map_t *kwargs) {
314+
STATIC mp_obj_t mp_builtin_min(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
328315
return mp_builtin_min_max(n_args, args, kwargs, MP_BINARY_OP_LESS);
329316
}
330317
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_min_obj, 1, mp_builtin_min);
@@ -337,17 +324,15 @@ STATIC mp_obj_t mp_builtin_next(mp_obj_t o) {
337324
return ret;
338325
}
339326
}
340-
341327
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_next_obj, mp_builtin_next);
342328

343329
STATIC mp_obj_t mp_builtin_oct(mp_obj_t o_in) {
344330
return mp_binary_op(MP_BINARY_OP_MODULO, MP_OBJ_NEW_QSTR(MP_QSTR__percent__hash_o), o_in);
345331
}
346-
347332
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_oct_obj, mp_builtin_oct);
348333

349334
STATIC mp_obj_t mp_builtin_ord(mp_obj_t o_in) {
350-
uint len;
335+
mp_uint_t len;
351336
const char *str = mp_obj_str_get_data(o_in, &len);
352337
#if MICROPY_PY_BUILTINS_STR_UNICODE
353338
mp_uint_t charlen = unichar_charlen(str, len);
@@ -376,26 +361,24 @@ STATIC mp_obj_t mp_builtin_ord(mp_obj_t o_in) {
376361
}
377362
#endif
378363
}
379-
380364
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_ord_obj, mp_builtin_ord);
381365

382-
STATIC mp_obj_t mp_builtin_pow(uint n_args, const mp_obj_t *args) {
366+
STATIC mp_obj_t mp_builtin_pow(mp_uint_t n_args, const mp_obj_t *args) {
383367
assert(2 <= n_args && n_args <= 3);
384368
switch (n_args) {
385369
case 2: return mp_binary_op(MP_BINARY_OP_POWER, args[0], args[1]);
386370
default: return mp_binary_op(MP_BINARY_OP_MODULO, mp_binary_op(MP_BINARY_OP_POWER, args[0], args[1]), args[2]); // TODO optimise...
387371
}
388372
}
389-
390373
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_pow_obj, 2, 3, mp_builtin_pow);
391374

392-
STATIC mp_obj_t mp_builtin_print(uint n_args, const mp_obj_t *args, mp_map_t *kwargs) {
375+
STATIC mp_obj_t mp_builtin_print(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
393376
mp_map_elem_t *sep_elem = mp_map_lookup(kwargs, MP_OBJ_NEW_QSTR(MP_QSTR_sep), MP_MAP_LOOKUP);
394377
mp_map_elem_t *end_elem = mp_map_lookup(kwargs, MP_OBJ_NEW_QSTR(MP_QSTR_end), MP_MAP_LOOKUP);
395378
const char *sep_data = " ";
396-
uint sep_len = 1;
379+
mp_uint_t sep_len = 1;
397380
const char *end_data = "\n";
398-
uint end_len = 1;
381+
mp_uint_t end_len = 1;
399382
if (sep_elem != NULL && sep_elem->value != mp_const_none) {
400383
sep_data = mp_obj_str_get_data(sep_elem->value, &sep_len);
401384
}
@@ -434,7 +417,6 @@ STATIC mp_obj_t mp_builtin_print(uint n_args, const mp_obj_t *args, mp_map_t *kw
434417
#endif
435418
return mp_const_none;
436419
}
437-
438420
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_print_obj, 0, mp_builtin_print);
439421

440422
STATIC mp_obj_t mp_builtin_repr(mp_obj_t o_in) {
@@ -447,7 +429,7 @@ STATIC mp_obj_t mp_builtin_repr(mp_obj_t o_in) {
447429

448430
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_repr_obj, mp_builtin_repr);
449431

450-
STATIC mp_obj_t mp_builtin_sum(uint n_args, const mp_obj_t *args) {
432+
STATIC mp_obj_t mp_builtin_sum(mp_uint_t n_args, const mp_obj_t *args) {
451433
assert(1 <= n_args && n_args <= 2);
452434
mp_obj_t value;
453435
switch (n_args) {
@@ -461,10 +443,9 @@ STATIC mp_obj_t mp_builtin_sum(uint n_args, const mp_obj_t *args) {
461443
}
462444
return value;
463445
}
464-
465446
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_sum_obj, 1, 2, mp_builtin_sum);
466447

467-
STATIC mp_obj_t mp_builtin_sorted(uint n_args, const mp_obj_t *args, mp_map_t *kwargs) {
448+
STATIC mp_obj_t mp_builtin_sorted(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
468449
assert(n_args >= 1);
469450
if (n_args > 1) {
470451
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError,
@@ -475,7 +456,6 @@ STATIC mp_obj_t mp_builtin_sorted(uint n_args, const mp_obj_t *args, mp_map_t *k
475456

476457
return self;
477458
}
478-
479459
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_sorted_obj, 1, mp_builtin_sorted);
480460

481461
STATIC mp_obj_t mp_builtin_id(mp_obj_t o_in) {
@@ -495,7 +475,6 @@ STATIC mp_obj_t mp_builtin_id(mp_obj_t o_in) {
495475
return mp_obj_new_int_from_uint((mp_uint_t)id);
496476
}
497477
}
498-
499478
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_id_obj, mp_builtin_id);
500479

501480
// See mp_load_attr() if making any changes
@@ -514,7 +493,7 @@ STATIC inline mp_obj_t mp_load_attr_default(mp_obj_t base, qstr attr, mp_obj_t d
514493
}
515494
}
516495

517-
STATIC mp_obj_t mp_builtin_getattr(uint n_args, const mp_obj_t *args) {
496+
STATIC mp_obj_t mp_builtin_getattr(mp_uint_t n_args, const mp_obj_t *args) {
518497
mp_obj_t attr = args[1];
519498
if (MP_OBJ_IS_TYPE(attr, &mp_type_str)) {
520499
attr = mp_obj_str_intern(attr);
@@ -527,7 +506,6 @@ STATIC mp_obj_t mp_builtin_getattr(uint n_args, const mp_obj_t *args) {
527506
}
528507
return mp_load_attr_default(args[0], MP_OBJ_QSTR_VALUE(attr), defval);
529508
}
530-
531509
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_getattr_obj, 2, 3, mp_builtin_getattr);
532510

533511
STATIC mp_obj_t mp_builtin_hasattr(mp_obj_t object_in, mp_obj_t attr_in) {
@@ -542,7 +520,6 @@ STATIC mp_obj_t mp_builtin_hasattr(mp_obj_t object_in, mp_obj_t attr_in) {
542520

543521
return MP_BOOL(dest[0] != MP_OBJ_NULL);
544522
}
545-
546523
MP_DEFINE_CONST_FUN_OBJ_2(mp_builtin_hasattr_obj, mp_builtin_hasattr);
547524

548525
// These are defined in terms of MicroPython API functions right away

py/builtinevex.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#include "builtin.h"
4242

4343
STATIC mp_obj_t parse_compile_execute(mp_obj_t o_in, mp_parse_input_kind_t parse_input_kind) {
44-
uint str_len;
44+
mp_uint_t str_len;
4545
const char *str = mp_obj_str_get_data(o_in, &str_len);
4646

4747
// create the lexer

py/builtinimport.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ STATIC mp_import_stat_t find_file(const char *file_str, uint file_len, vstr_t *d
8484
// go through each path looking for a directory or file
8585
for (int i = 0; i < path_num; i++) {
8686
vstr_reset(dest);
87-
uint p_len;
87+
mp_uint_t p_len;
8888
const char *p = mp_obj_str_get_data(path_items[i], &p_len);
8989
if (p_len > 0) {
9090
vstr_add_strn(dest, p, p_len);
@@ -185,8 +185,8 @@ mp_obj_t mp_builtin___import__(uint n_args, mp_obj_t *args) {
185185
}
186186
}
187187

188-
uint mod_len;
189-
const char *mod_str = (const char*)mp_obj_str_get_data(module_name, &mod_len);
188+
mp_uint_t mod_len;
189+
const char *mod_str = mp_obj_str_get_data(module_name, &mod_len);
190190

191191
if (level != 0) {
192192
// What we want to do here is to take name of current module,
@@ -204,8 +204,8 @@ mp_obj_t mp_builtin___import__(uint n_args, mp_obj_t *args) {
204204
printf("\n");
205205
#endif
206206

207-
uint this_name_l;
208-
const char *this_name = (const char*)mp_obj_str_get_data(this_name_q, &this_name_l);
207+
mp_uint_t this_name_l;
208+
const char *this_name = mp_obj_str_get_data(this_name_q, &this_name_l);
209209

210210
uint dots_seen = 0;
211211
const char *p = this_name + this_name_l - 1;
@@ -353,5 +353,4 @@ mp_obj_t mp_builtin___import__(uint n_args, mp_obj_t *args) {
353353
// Otherwise, we need to return top-level package
354354
return top_module_obj;
355355
}
356-
357356
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin___import___obj, 1, 5, mp_builtin___import__);

py/obj.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -365,25 +365,25 @@ mp_obj_t mp_obj_new_bool(bool value);
365365
mp_obj_t mp_obj_new_cell(mp_obj_t obj);
366366
mp_obj_t mp_obj_new_int(mp_int_t value);
367367
mp_obj_t mp_obj_new_int_from_uint(mp_uint_t value);
368-
mp_obj_t mp_obj_new_int_from_str_len(const char **str, uint len, bool neg, uint base);
368+
mp_obj_t mp_obj_new_int_from_str_len(const char **str, mp_uint_t len, bool neg, mp_uint_t base);
369369
mp_obj_t mp_obj_new_int_from_ll(long long val); // this must return a multi-precision integer object (or raise an overflow exception)
370-
mp_obj_t mp_obj_new_str(const char* data, uint len, bool make_qstr_if_not_already);
371-
mp_obj_t mp_obj_new_bytes(const byte* data, uint len);
370+
mp_obj_t mp_obj_new_str(const char* data, mp_uint_t len, bool make_qstr_if_not_already);
371+
mp_obj_t mp_obj_new_bytes(const byte* data, mp_uint_t len);
372372
#if MICROPY_PY_BUILTINS_FLOAT
373373
mp_obj_t mp_obj_new_float(mp_float_t val);
374374
mp_obj_t mp_obj_new_complex(mp_float_t real, mp_float_t imag);
375375
#endif
376376
mp_obj_t mp_obj_new_exception(const mp_obj_type_t *exc_type);
377377
mp_obj_t mp_obj_new_exception_arg1(const mp_obj_type_t *exc_type, mp_obj_t arg);
378-
mp_obj_t mp_obj_new_exception_args(const mp_obj_type_t *exc_type, uint n_args, const mp_obj_t *args);
378+
mp_obj_t mp_obj_new_exception_args(const mp_obj_type_t *exc_type, mp_uint_t n_args, const mp_obj_t *args);
379379
mp_obj_t mp_obj_new_exception_msg(const mp_obj_type_t *exc_type, const char *msg);
380380
mp_obj_t mp_obj_new_exception_msg_varg(const mp_obj_type_t *exc_type, const char *fmt, ...); // counts args by number of % symbols in fmt, excluding %%; can only handle void* sizes (ie no float/double!)
381381
mp_obj_t mp_obj_new_fun_bc(mp_uint_t scope_flags, qstr *args, mp_uint_t n_pos_args, mp_uint_t n_kwonly_args, mp_obj_t def_args, mp_obj_t def_kw_args, const byte *code);
382382
mp_obj_t mp_obj_new_fun_native(mp_uint_t n_args, void *fun_data);
383383
mp_obj_t mp_obj_new_fun_viper(mp_uint_t n_args, void *fun_data, mp_uint_t type_sig);
384384
mp_obj_t mp_obj_new_fun_asm(mp_uint_t n_args, void *fun_data);
385385
mp_obj_t mp_obj_new_gen_wrap(mp_obj_t fun);
386-
mp_obj_t mp_obj_new_closure(mp_obj_t fun, uint n_closed, const mp_obj_t *closed);
386+
mp_obj_t mp_obj_new_closure(mp_obj_t fun, mp_uint_t n_closed, const mp_obj_t *closed);
387387
mp_obj_t mp_obj_new_tuple(mp_uint_t n, const mp_obj_t *items);
388388
mp_obj_t mp_obj_new_list(mp_uint_t n, mp_obj_t *items);
389389
mp_obj_t mp_obj_new_dict(mp_uint_t n_args);
@@ -463,17 +463,17 @@ mp_obj_t mp_alloc_emergency_exception_buf(mp_obj_t size_in);
463463
void mp_init_emergency_exception_buf(void);
464464

465465
// str
466-
mp_obj_t mp_obj_str_builder_start(const mp_obj_type_t *type, uint len, byte **data);
466+
mp_obj_t mp_obj_str_builder_start(const mp_obj_type_t *type, mp_uint_t len, byte **data);
467467
mp_obj_t mp_obj_str_builder_end(mp_obj_t o_in);
468468
mp_obj_t mp_obj_str_builder_end_with_len(mp_obj_t o_in, mp_uint_t len);
469469
bool mp_obj_str_equal(mp_obj_t s1, mp_obj_t s2);
470-
uint mp_obj_str_get_hash(mp_obj_t self_in);
471-
uint mp_obj_str_get_len(mp_obj_t self_in);
470+
mp_uint_t mp_obj_str_get_hash(mp_obj_t self_in);
471+
mp_uint_t mp_obj_str_get_len(mp_obj_t self_in);
472472
qstr mp_obj_str_get_qstr(mp_obj_t self_in); // use this if you will anyway convert the string to a qstr
473473
const char *mp_obj_str_get_str(mp_obj_t self_in); // use this only if you need the string to be null terminated
474-
const char *mp_obj_str_get_data(mp_obj_t self_in, uint *len);
474+
const char *mp_obj_str_get_data(mp_obj_t self_in, mp_uint_t *len);
475475
mp_obj_t mp_obj_str_intern(mp_obj_t str);
476-
void mp_str_print_quoted(void (*print)(void *env, const char *fmt, ...), void *env, const byte *str_data, uint str_len, bool is_bytes);
476+
void mp_str_print_quoted(void (*print)(void *env, const char *fmt, ...), void *env, const byte *str_data, mp_uint_t str_len, bool is_bytes);
477477

478478
#if MICROPY_PY_BUILTINS_FLOAT
479479
// float
@@ -522,8 +522,8 @@ void mp_obj_set_store(mp_obj_t self_in, mp_obj_t item);
522522
void mp_obj_slice_get(mp_obj_t self_in, mp_obj_t *start, mp_obj_t *stop, mp_obj_t *step);
523523

524524
// array
525-
uint mp_obj_array_len(mp_obj_t self_in);
526-
mp_obj_t mp_obj_new_bytearray_by_ref(uint n, void *items);
525+
mp_uint_t mp_obj_array_len(mp_obj_t self_in);
526+
mp_obj_t mp_obj_new_bytearray_by_ref(mp_uint_t n, void *items);
527527

528528
// functions
529529
#define MP_OBJ_FUN_ARGS_MAX (0xffff) // to set maximum value in n_args_max below
@@ -569,17 +569,17 @@ typedef struct {
569569
mp_int_t step;
570570
} mp_bound_slice_t;
571571

572-
void mp_seq_multiply(const void *items, uint item_sz, uint len, uint times, void *dest);
572+
void mp_seq_multiply(const void *items, mp_uint_t item_sz, mp_uint_t len, mp_uint_t times, void *dest);
573573
#if MICROPY_PY_BUILTINS_SLICE
574574
bool mp_seq_get_fast_slice_indexes(mp_uint_t len, mp_obj_t slice, mp_bound_slice_t *indexes);
575575
#endif
576576
#define mp_seq_copy(dest, src, len, item_t) memcpy(dest, src, len * sizeof(item_t))
577577
#define mp_seq_cat(dest, src1, len1, src2, len2, item_t) { memcpy(dest, src1, (len1) * sizeof(item_t)); memcpy(dest + (len1), src2, (len2) * sizeof(item_t)); }
578-
bool mp_seq_cmp_bytes(int op, const byte *data1, uint len1, const byte *data2, uint len2);
579-
bool mp_seq_cmp_objs(int op, const mp_obj_t *items1, uint len1, const mp_obj_t *items2, uint len2);
580-
mp_obj_t mp_seq_index_obj(const mp_obj_t *items, uint len, uint n_args, const mp_obj_t *args);
581-
mp_obj_t mp_seq_count_obj(const mp_obj_t *items, uint len, mp_obj_t value);
582-
mp_obj_t mp_seq_extract_slice(uint len, const mp_obj_t *seq, mp_bound_slice_t *indexes);
578+
bool mp_seq_cmp_bytes(int op, const byte *data1, mp_uint_t len1, const byte *data2, mp_uint_t len2);
579+
bool mp_seq_cmp_objs(int op, const mp_obj_t *items1, mp_uint_t len1, const mp_obj_t *items2, mp_uint_t len2);
580+
mp_obj_t mp_seq_index_obj(const mp_obj_t *items, mp_uint_t len, mp_uint_t n_args, const mp_obj_t *args);
581+
mp_obj_t mp_seq_count_obj(const mp_obj_t *items, mp_uint_t len, mp_obj_t value);
582+
mp_obj_t mp_seq_extract_slice(mp_uint_t len, const mp_obj_t *seq, mp_bound_slice_t *indexes);
583583
// Helper to clear stale pointers from allocated, but unused memory, to preclude GC problems
584584
#define mp_seq_clear(start, len, alloc_len, item_sz) memset((byte*)(start) + (len) * (item_sz), 0, ((alloc_len) - (len)) * (item_sz))
585585
#define mp_seq_replace_slice_no_grow(dest, dest_len, beg, end, slice, slice_len, item_t) \

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy