py/mpz: Fix conversion of float to mpz so it works on big endian archs.

This commit is contained in:
Damien George 2016-01-08 17:56:58 +00:00
parent b1fa907d56
commit 2adf7ec3dd
1 changed files with 4 additions and 0 deletions

View File

@ -711,7 +711,11 @@ 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 = {src};
z->neg = u.p.sgn;