diff options
author | Yoctopuce <dev@yoctopuce.com> | 2024-05-24 11:56:40 +0200 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2025-01-02 13:36:33 +1100 |
commit | 5d12df51fc431ecb159112bf4a40983c2ccba165 (patch) | |
tree | 10fd877298f97f80638291a59e35f79df77e29ea /py/obj.h | |
parent | 9bb6b50693fe9d813e95af01f1af4d850ebb0b07 (diff) |
py/obj: Make literals unsigned in float get/new functions.
Fixes gcc warning when -Wsign-conversion is on.
Signed-off-by: Yoctopuce <dev@yoctopuce.com>
Diffstat (limited to 'py/obj.h')
-rw-r--r-- | py/obj.h | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -203,7 +203,7 @@ static inline mp_float_t mp_obj_float_get(mp_const_obj_t o) { union { mp_float_t f; mp_uint_t u; - } num = {.u = ((mp_uint_t)o - 0x80800000) & ~3}; + } num = {.u = ((mp_uint_t)o - 0x80800000u) & ~3u}; return num.f; } static inline mp_obj_t mp_obj_new_float(mp_float_t f) { @@ -211,7 +211,7 @@ static inline mp_obj_t mp_obj_new_float(mp_float_t f) { mp_float_t f; mp_uint_t u; } num = {.f = f}; - return (mp_obj_t)(((num.u & ~0x3) | 2) + 0x80800000); + return (mp_obj_t)(((num.u & ~0x3u) | 2u) + 0x80800000u); } #endif |