diff options
Diffstat (limited to 'py/obj.c')
-rw-r--r-- | py/obj.c | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -83,7 +83,7 @@ void mp_obj_print(mp_obj_t o_in, mp_print_kind_t kind) { // helper function to print an exception with traceback void mp_obj_print_exception(mp_obj_t exc) { if (mp_obj_is_exception_instance(exc)) { - machine_uint_t n, *values; + mp_uint_t n, *values; mp_obj_exception_get_traceback(exc, &n, &values); if (n > 0) { assert(n % 3 == 0); @@ -145,7 +145,7 @@ bool mp_obj_is_callable(mp_obj_t o_in) { return mp_obj_get_type(o_in)->call != NULL; } -machine_int_t mp_obj_hash(mp_obj_t o_in) { +mp_int_t mp_obj_hash(mp_obj_t o_in) { if (o_in == mp_const_false) { return 0; // needs to hash to same as the integer 0, since False==0 } else if (o_in == mp_const_true) { @@ -155,13 +155,13 @@ machine_int_t mp_obj_hash(mp_obj_t o_in) { } else if (MP_OBJ_IS_STR(o_in) || MP_OBJ_IS_TYPE(o_in, &mp_type_bytes)) { return mp_obj_str_get_hash(o_in); } else if (MP_OBJ_IS_TYPE(o_in, &mp_type_NoneType)) { - return (machine_int_t)o_in; + return (mp_int_t)o_in; } else if (MP_OBJ_IS_TYPE(o_in, &mp_type_fun_native) || MP_OBJ_IS_TYPE(o_in, &mp_type_fun_bc)) { - return (machine_int_t)o_in; + return (mp_int_t)o_in; } else if (MP_OBJ_IS_TYPE(o_in, &mp_type_tuple)) { return mp_obj_tuple_hash(o_in); } else if (MP_OBJ_IS_TYPE(o_in, &mp_type_type)) { - return (machine_int_t)o_in; + return (mp_int_t)o_in; // TODO hash class and instances // TODO delegate to __hash__ method if it exists @@ -225,7 +225,7 @@ bool mp_obj_equal(mp_obj_t o1, mp_obj_t o2) { return false; } -machine_int_t mp_obj_get_int(mp_const_obj_t arg) { +mp_int_t mp_obj_get_int(mp_const_obj_t arg) { // This function essentially performs implicit type conversion to int // Note that Python does NOT provide implicit type conversion from // float to int in the core expression language, try some_list[1.0]. @@ -244,8 +244,8 @@ machine_int_t mp_obj_get_int(mp_const_obj_t arg) { // returns false if arg is not of integral type // returns true and sets *value if it is of integral type -// can throw OverflowError if arg is of integral type, but doesn't fit in a machine_int_t -bool mp_obj_get_int_maybe(mp_const_obj_t arg, machine_int_t *value) { +// can throw OverflowError if arg is of integral type, but doesn't fit in a mp_int_t +bool mp_obj_get_int_maybe(mp_const_obj_t arg, mp_int_t *value) { if (arg == mp_const_false) { *value = 0; } else if (arg == mp_const_true) { @@ -330,8 +330,8 @@ void mp_obj_get_array_fixed_n(mp_obj_t o, uint len, mp_obj_t **items) { } // is_slice determines whether the index is a slice index -uint mp_get_index(const mp_obj_type_t *type, machine_uint_t len, mp_obj_t index, bool is_slice) { - machine_int_t i; +uint mp_get_index(const mp_obj_type_t *type, mp_uint_t len, mp_obj_t index, bool is_slice) { + mp_int_t i; if (MP_OBJ_IS_SMALL_INT(index)) { i = MP_OBJ_SMALL_INT_VALUE(index); } else if (!mp_obj_get_int_maybe(index, &i)) { @@ -363,7 +363,7 @@ mp_obj_t mp_obj_len_maybe(mp_obj_t o_in) { MP_OBJ_IS_STR(o_in) || #endif MP_OBJ_IS_TYPE(o_in, &mp_type_bytes)) { - return MP_OBJ_NEW_SMALL_INT((machine_int_t)mp_obj_str_get_len(o_in)); + return MP_OBJ_NEW_SMALL_INT((mp_int_t)mp_obj_str_get_len(o_in)); } else { mp_obj_type_t *type = mp_obj_get_type(o_in); if (type->unary_op != NULL) { |