Skip to content

Commit 2adf7ec

Browse files
committed
py/mpz: Fix conversion of float to mpz so it works on big endian archs.
1 parent b1fa907 commit 2adf7ec

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

py/mpz.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,11 @@ typedef uint32_t mp_float_int_t;
711711
#endif
712712
union {
713713
mp_float_t f;
714+
#if MP_ENDIANNESS_LITTLE
714715
struct { mp_float_int_t frc:MP_FLOAT_FRAC_BITS, exp:MP_FLOAT_EXP_BITS, sgn:1; } p;
716+
#else
717+
struct { mp_float_int_t sgn:1, exp:MP_FLOAT_EXP_BITS, frc:MP_FLOAT_FRAC_BITS; } p;
718+
#endif
715719
} u = {src};
716720

717721
z->neg = u.p.sgn;

0 commit comments

Comments
 (0)