Skip to content

Commit 8d427b7

Browse files
doogledpgeorge
authored andcommitted
py: Fix issue in mpz_set_from_float() when mp_int_t is larger than float
1 parent c585ad1 commit 8d427b7

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

py/mpz.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,10 +747,16 @@ typedef uint32_t mp_float_int_t;
747747
z->dig[dig_ind++] = (frc << shft) & DIG_MASK;
748748
frc >>= DIG_SIZE - shft;
749749
}
750+
#if DIG_SIZE < (MP_FLOAT_FRAC_BITS + 1)
750751
while (dig_ind != dig_cnt) {
751752
z->dig[dig_ind++] = frc & DIG_MASK;
752753
frc >>= DIG_SIZE;
753754
}
755+
#else
756+
if (dig_ind != dig_cnt) {
757+
z->dig[dig_ind] = frc;
758+
}
759+
#endif
754760
}
755761
}
756762
}

0 commit comments

Comments
 (0)