py: Fix issue in mpz_set_from_float() when mp_int_t is larger than float
This commit is contained in:
parent
c585ad1020
commit
8d427b7ab7
6
py/mpz.c
6
py/mpz.c
|
@ -747,10 +747,16 @@ typedef uint32_t mp_float_int_t;
|
|||
z->dig[dig_ind++] = (frc << shft) & DIG_MASK;
|
||||
frc >>= DIG_SIZE - shft;
|
||||
}
|
||||
#if DIG_SIZE < (MP_FLOAT_FRAC_BITS + 1)
|
||||
while (dig_ind != dig_cnt) {
|
||||
z->dig[dig_ind++] = frc & DIG_MASK;
|
||||
frc >>= DIG_SIZE;
|
||||
}
|
||||
#else
|
||||
if (dig_ind != dig_cnt) {
|
||||
z->dig[dig_ind] = frc;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue