py: Fix issue in mpz_set_from_float() when mp_int_t is larger than float

This commit is contained in:
David Steinberg 2015-01-13 15:20:32 +00:00 committed by Damien George
parent c585ad1020
commit 8d427b7ab7
1 changed files with 6 additions and 0 deletions

View File

@ -747,10 +747,16 @@ typedef uint32_t mp_float_int_t;
z->dig[dig_ind++] = (frc << shft) & DIG_MASK; z->dig[dig_ind++] = (frc << shft) & DIG_MASK;
frc >>= DIG_SIZE - shft; frc >>= DIG_SIZE - shft;
} }
#if DIG_SIZE < (MP_FLOAT_FRAC_BITS + 1)
while (dig_ind != dig_cnt) { while (dig_ind != dig_cnt) {
z->dig[dig_ind++] = frc & DIG_MASK; z->dig[dig_ind++] = frc & DIG_MASK;
frc >>= DIG_SIZE; frc >>= DIG_SIZE;
} }
#else
if (dig_ind != dig_cnt) {
z->dig[dig_ind] = frc;
}
#endif
} }
} }
} }