summaryrefslogtreecommitdiff
path: root/py/obj.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/obj.c')
-rw-r--r--py/obj.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/py/obj.c b/py/obj.c
index 5a05ea58c..b461fe50a 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -383,22 +383,7 @@ mp_float_t mp_obj_get_float(mp_obj_t arg) {
#if MICROPY_PY_BUILTINS_COMPLEX
bool mp_obj_get_complex_maybe(mp_obj_t arg, mp_float_t *real, mp_float_t *imag) {
- if (arg == mp_const_false) {
- *real = 0;
- *imag = 0;
- } else if (arg == mp_const_true) {
- *real = 1;
- *imag = 0;
- } else if (mp_obj_is_small_int(arg)) {
- *real = (mp_float_t)MP_OBJ_SMALL_INT_VALUE(arg);
- *imag = 0;
- #if MICROPY_LONGINT_IMPL != MICROPY_LONGINT_IMPL_NONE
- } else if (mp_obj_is_exact_type(arg, &mp_type_int)) {
- *real = mp_obj_int_as_float_impl(arg);
- *imag = 0;
- #endif
- } else if (mp_obj_is_float(arg)) {
- *real = mp_obj_float_get(arg);
+ if (mp_obj_get_float_maybe(arg, real)) {
*imag = 0;
} else if (mp_obj_is_type(arg, &mp_type_complex)) {
mp_obj_complex_get(arg, real, imag);