Browse Source

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

pull/1770/merge
Damien George 9 years ago
parent
commit
2adf7ec3dd
  1. 4
      py/mpz.c

4
py/mpz.c

@ -711,7 +711,11 @@ typedef uint32_t mp_float_int_t;
#endif #endif
union { union {
mp_float_t f; 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; 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}; } u = {src};
z->neg = u.p.sgn; z->neg = u.p.sgn;

Loading…
Cancel
Save