diff options
author | Damien George <damien.p.george@gmail.com> | 2020-02-14 12:26:46 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-02-18 13:04:36 +1100 |
commit | ce39c958ef0d948011ecb815ef0e7eb5ace9e288 (patch) | |
tree | 03dd03cc7c8c94f89853c6db6810d5f59cc37827 /py/objfloat.c | |
parent | ac8383a95d3cf39f8d8433f5c58f62dd74536110 (diff) |
py: Factor out definition of mp_float_union_t to one location.
Diffstat (limited to 'py/objfloat.c')
-rw-r--r-- | py/objfloat.c | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/py/objfloat.c b/py/objfloat.c index 347f692a4..c19cc3960 100644 --- a/py/objfloat.c +++ b/py/objfloat.c @@ -60,21 +60,7 @@ const mp_obj_float_t mp_const_float_pi_obj = {{&mp_type_float}, M_PI}; #if MICROPY_FLOAT_HIGH_QUALITY_HASH // must return actual integer value if it fits in mp_int_t mp_int_t mp_float_hash(mp_float_t src) { -#if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_DOUBLE -typedef uint64_t mp_float_uint_t; -#elif MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT -typedef uint32_t mp_float_uint_t; -#endif - union { - mp_float_t f; - #if MP_ENDIANNESS_LITTLE - struct { mp_float_uint_t frc:MP_FLOAT_FRAC_BITS, exp:MP_FLOAT_EXP_BITS, sgn:1; } p; - #else - struct { mp_float_uint_t sgn:1, exp:MP_FLOAT_EXP_BITS, frc:MP_FLOAT_FRAC_BITS; } p; - #endif - mp_float_uint_t i; - } u = {.f = src}; - + mp_float_union_t u = {.f = src}; mp_int_t val; const int adj_exp = (int)u.p.exp - MP_FLOAT_EXP_BIAS; if (adj_exp < 0) { |