diff options
| author | Damien George <damien.p.george@gmail.com> | 2018-07-14 23:05:25 +1000 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2018-07-14 23:05:25 +1000 |
| commit | e94d644a811407cf5f075d4176f689d3225c1d95 (patch) | |
| tree | 8f15eb796de028efc377ef12ce7a7be14cb60f95 /py/runtime.c | |
| parent | 2a3979bcb3077930056c3cba03f073f55afd510a (diff) | |
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.
Diffstat (limited to 'py/runtime.c')
| -rw-r--r-- | py/runtime.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/py/runtime.c b/py/runtime.c index 33ef9da4b..ee3c2b222 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -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)) { |
