diff options
| author | Damien George | 2020-02-14 12:26:46 +1100 |
|---|---|---|
| committer | Damien George | 2020-02-18 13:04:36 +1100 |
| commit | ce39c958ef0d948011ecb815ef0e7eb5ace9e288 (patch) | |
| tree | 03dd03cc7c8c94f89853c6db6810d5f59cc37827 /extmod/modurandom.c | |
| parent | ac8383a95d3cf39f8d8433f5c58f62dd74536110 (diff) | |
py: Factor out definition of mp_float_union_t to one location.
Diffstat (limited to 'extmod/modurandom.c')
| -rw-r--r-- | extmod/modurandom.c | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/extmod/modurandom.c b/extmod/modurandom.c index 34fe1b749..725ac46f1 100644 --- a/extmod/modurandom.c +++ b/extmod/modurandom.c @@ -163,19 +163,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_urandom_choice_obj, mod_urandom_choice); // returns a number in the range [0..1) using Yasmarang to fill in the fraction bits STATIC mp_float_t yasmarang_float(void) { - #if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_DOUBLE - typedef uint64_t mp_float_int_t; - #elif MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT - typedef uint32_t mp_float_int_t; - #endif - union { - mp_float_t f; - #if MP_ENDIANNESS_LITTLE - struct { mp_float_int_t frc:MP_FLOAT_FRAC_BITS, exp:MP_FLOAT_EXP_BITS, sgn:1; } p; - #else - struct { mp_float_int_t sgn:1, exp:MP_FLOAT_EXP_BITS, frc:MP_FLOAT_FRAC_BITS; } p; - #endif - } u; + mp_float_union_t u; u.p.sgn = 0; u.p.exp = (1 << (MP_FLOAT_EXP_BITS - 1)) - 1; if (MP_FLOAT_FRAC_BITS <= 32) { |
