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:
parent
2a3979bcb3
commit
e94d644a81
@ -496,11 +496,11 @@ mp_obj_t mp_binary_op(mp_binary_op_t op, mp_obj_t lhs, mp_obj_t rhs) {
|
|||||||
default:
|
default:
|
||||||
goto unsupported_op;
|
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)) {
|
if (MP_SMALL_INT_FITS(lhs_val)) {
|
||||||
return MP_OBJ_NEW_SMALL_INT(lhs_val);
|
return MP_OBJ_NEW_SMALL_INT(lhs_val);
|
||||||
} else {
|
} else {
|
||||||
return mp_obj_new_int(lhs_val);
|
return mp_obj_new_int_from_ll(lhs_val);
|
||||||
}
|
}
|
||||||
#if MICROPY_PY_BUILTINS_FLOAT
|
#if MICROPY_PY_BUILTINS_FLOAT
|
||||||
} else if (mp_obj_is_float(rhs)) {
|
} else if (mp_obj_is_float(rhs)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user