py/objint: Rename mp_obj_int_as_float to mp_obj_int_as_float_impl.

And also simplify it to remove the check for small int.  This can be done
because this function is only ever called if the argument is not a small
int.
This commit is contained in:
Damien George
2016-12-21 11:46:27 +11:00
parent 67f3edc10a
commit e4af712125
6 changed files with 15 additions and 25 deletions

View File

@@ -271,8 +271,10 @@ mp_float_t mp_obj_get_float(mp_obj_t arg) {
return 1;
} else if (MP_OBJ_IS_SMALL_INT(arg)) {
return MP_OBJ_SMALL_INT_VALUE(arg);
#if MICROPY_LONGINT_IMPL != MICROPY_LONGINT_IMPL_NONE
} else if (MP_OBJ_IS_TYPE(arg, &mp_type_int)) {
return mp_obj_int_as_float(arg);
return mp_obj_int_as_float_impl(arg);
#endif
} else if (mp_obj_is_float(arg)) {
return mp_obj_float_get(arg);
} else {
@@ -296,9 +298,11 @@ void mp_obj_get_complex(mp_obj_t arg, mp_float_t *real, mp_float_t *imag) {
} else if (MP_OBJ_IS_SMALL_INT(arg)) {
*real = MP_OBJ_SMALL_INT_VALUE(arg);
*imag = 0;
#if MICROPY_LONGINT_IMPL != MICROPY_LONGINT_IMPL_NONE
} else if (MP_OBJ_IS_TYPE(arg, &mp_type_int)) {
*real = mp_obj_int_as_float(arg);
*real = mp_obj_int_as_float_impl(arg);
*imag = 0;
#endif
} else if (mp_obj_is_float(arg)) {
*real = mp_obj_float_get(arg);
*imag = 0;