diff options
Diffstat (limited to 'py/runtime.c')
-rw-r--r-- | py/runtime.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/py/runtime.c b/py/runtime.c index ea75280ce4..a9d57460ac 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -98,6 +98,13 @@ void mp_deinit(void) { #endif } +mp_obj_t mp_load_const_int(qstr qstr) { + DEBUG_OP_printf("load '%s'\n", qstr_str(qstr)); + uint len; + const byte* data = qstr_data(qstr, &len); + return mp_parse_num_integer((const char*)data, len, 0); +} + mp_obj_t mp_load_const_dec(qstr qstr) { DEBUG_OP_printf("load '%s'\n", qstr_str(qstr)); uint len; @@ -406,7 +413,7 @@ mp_obj_t mp_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) { goto unsupported_op; } // TODO: We just should make mp_obj_new_int() inline and use that - if (MP_OBJ_FITS_SMALL_INT(lhs_val)) { + if (MP_SMALL_INT_FITS(lhs_val)) { return MP_OBJ_NEW_SMALL_INT(lhs_val); } else { return mp_obj_new_int(lhs_val); @@ -1147,8 +1154,8 @@ void *m_malloc_fail(int num_bytes) { // these must correspond to the respective enum void *const mp_fun_table[MP_F_NUMBER_OF] = { + mp_load_const_int, mp_load_const_dec, - mp_obj_new_int_from_qstr, mp_load_const_str, mp_load_name, mp_load_global, |