diff options
author | stijn <stijn@ignitron.net> | 2020-04-09 09:05:48 +0200 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-04-18 22:36:14 +1000 |
commit | 0ba68f8a1dae84de950420aebf8ad46582a38e66 (patch) | |
tree | c996a9b3d26f58b286ef6f9deb508de141b66574 /ports/unix/modusocket.c | |
parent | b909e8b2dd007d8e7d61547768518b29bb4f833c (diff) |
all: Fix implicit floating point promotion.
Initially some of these were found building the unix coverage variant on
MacOS because that build uses clang and has -Wdouble-promotion enabled, and
clang performs more vigorous promotion checks than gcc. Additionally the
codebase has been compiled with clang and msvc (the latter with warning
level 3), and with MICROPY_FLOAT_IMPL_FLOAT to find the rest of the
conversions.
Fixes are implemented either as explicit casts, or by using the correct
type, or by using one of the utility functions to handle floating point
casting; these have been moved from nativeglue.c to the public API.
Diffstat (limited to 'ports/unix/modusocket.c')
-rw-r--r-- | ports/unix/modusocket.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ports/unix/modusocket.c b/ports/unix/modusocket.c index 8bc453d42..f87a717c9 100644 --- a/ports/unix/modusocket.c +++ b/ports/unix/modusocket.c @@ -378,8 +378,8 @@ STATIC mp_obj_t socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) { if (timeout_in != mp_const_none) { #if MICROPY_PY_BUILTINS_FLOAT mp_float_t val = mp_obj_get_float(timeout_in); - double ipart; - tv.tv_usec = round(modf(val, &ipart) * 1000000); + mp_float_t ipart; + tv.tv_usec = MICROPY_FLOAT_C_FUN(round)(MICROPY_FLOAT_C_FUN(modf)(val, &ipart) * MICROPY_FLOAT_CONST(1000000.)); tv.tv_sec = ipart; #else tv.tv_sec = mp_obj_get_int(timeout_in); |