py/runtime: Use mp_obj_new_int_from_ll when return int is not small.

There's no need to call mp_obj_new_int() which will just fail the check for
small int and call mp_obj_new_int_from_ll() anyway.

Thanks to @Jongy for prompting this change.
This commit is contained in:
Damien George 2018-07-14 23:05:25 +10:00
parent 2a3979bcb3
commit e94d644a81

View File

@ -496,11 +496,11 @@ mp_obj_t mp_binary_op(mp_binary_op_t op, mp_obj_t lhs, mp_obj_t rhs) {
default:
goto unsupported_op;
}
// TODO: We just should make mp_obj_new_int() inline and use that
// This is an inlined version of mp_obj_new_int, for speed
if (MP_SMALL_INT_FITS(lhs_val)) {
return MP_OBJ_NEW_SMALL_INT(lhs_val);
} else {
return mp_obj_new_int(lhs_val);
return mp_obj_new_int_from_ll(lhs_val);
}
#if MICROPY_PY_BUILTINS_FLOAT
} else if (mp_obj_is_float(rhs)) {