Revert "all: Fix implicit casts of float/double, and signed comparison."
This reverts commit a2110bd3fc. There's
nothing inherently wrong with it, but upcoming commits will apply similar
fixes in a slightly different way.
This commit is contained in:
@@ -167,11 +167,11 @@ STATIC mp_obj_t return_ffi_value(ffi_arg val, char type) {
|
||||
union { ffi_arg ffi;
|
||||
float flt;
|
||||
} val_union = { .ffi = val };
|
||||
return mp_obj_new_float((mp_float_t)val_union.flt);
|
||||
return mp_obj_new_float(val_union.flt);
|
||||
}
|
||||
case 'd': {
|
||||
double *p = (double *)&val;
|
||||
return mp_obj_new_float((mp_float_t)*p);
|
||||
return mp_obj_new_float(*p);
|
||||
}
|
||||
#endif
|
||||
case 'O':
|
||||
|
||||
@@ -61,7 +61,7 @@ static inline int msec_sleep_tv(struct timeval *tv) {
|
||||
#endif
|
||||
|
||||
#if defined(MP_CLOCKS_PER_SEC)
|
||||
#define CLOCK_DIV (MP_CLOCKS_PER_SEC / MICROPY_FLOAT_CONST(1000.0))
|
||||
#define CLOCK_DIV (MP_CLOCKS_PER_SEC / 1000.0F)
|
||||
#else
|
||||
#error Unsupported clock() implementation
|
||||
#endif
|
||||
@@ -84,7 +84,7 @@ STATIC mp_obj_t mod_time_clock(void) {
|
||||
// float cannot represent full range of int32 precisely, so we pre-divide
|
||||
// int to reduce resolution, and then actually do float division hoping
|
||||
// to preserve integer part resolution.
|
||||
return mp_obj_new_float((mp_float_t)(clock() / 1000) / CLOCK_DIV);
|
||||
return mp_obj_new_float((float)(clock() / 1000) / CLOCK_DIV);
|
||||
#else
|
||||
return mp_obj_new_int((mp_int_t)clock());
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user