diff options
author | stijn <stijn@ignitron.net> | 2020-04-13 20:56:31 +0200 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-04-18 22:42:24 +1000 |
commit | 70affd9ba22e7f62666a9a2fafc2a3c0be9ef95a (patch) | |
tree | 068485d00339bf0b89a5b8ea328396ffa21a0b14 /py/obj.c | |
parent | bcf01d1686a8fa6d257daea25ce0d7df6e4ad839 (diff) |
all: Fix implicit floating point to integer conversions.
These are found when building with -Wfloat-conversion.
Diffstat (limited to 'py/obj.c')
-rw-r--r-- | py/obj.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -340,7 +340,7 @@ bool mp_obj_get_float_maybe(mp_obj_t arg, mp_float_t *value) { } else if (arg == mp_const_true) { val = 1; } else if (mp_obj_is_small_int(arg)) { - val = MP_OBJ_SMALL_INT_VALUE(arg); + val = (mp_float_t)MP_OBJ_SMALL_INT_VALUE(arg); #if MICROPY_LONGINT_IMPL != MICROPY_LONGINT_IMPL_NONE } else if (mp_obj_is_type(arg, &mp_type_int)) { val = mp_obj_int_as_float_impl(arg); @@ -379,7 +379,7 @@ void mp_obj_get_complex(mp_obj_t arg, mp_float_t *real, mp_float_t *imag) { *real = 1; *imag = 0; } else if (mp_obj_is_small_int(arg)) { - *real = MP_OBJ_SMALL_INT_VALUE(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_type(arg, &mp_type_int)) { |