From 8d427b7ab79d1d45d6aef2f0bbb73c65373247df Mon Sep 17 00:00:00 2001 From: David Steinberg Date: Tue, 13 Jan 2015 15:20:32 +0000 Subject: [PATCH] py: Fix issue in mpz_set_from_float() when mp_int_t is larger than float --- py/mpz.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/py/mpz.c b/py/mpz.c index 47cbf5db4a..c0a3d4b0b4 100644 --- a/py/mpz.c +++ b/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 } } }