summaryrefslogtreecommitdiff
path: root/mpz/inp_str.c
diff options
context:
space:
mode:
authorTorbjorn Granlund <tege@gmplib.org>2009-07-06 11:33:28 +0200
committerTorbjorn Granlund <tege@gmplib.org>2009-07-06 11:33:28 +0200
commit2e1d251e2296974f1d47fa37ffd1e208ecb7df11 (patch)
tree10d45ffb1b022e817d63b3dfd1e3e16cda772ff1 /mpz/inp_str.c
parent0070949c9074c899f6175cc4f52d0377c09da24c (diff)
downloadgmp-2e1d251e2296974f1d47fa37ffd1e208ecb7df11.tar.gz
Improve code for computing sizes related to mp_bases.
Diffstat (limited to 'mpz/inp_str.c')
-rw-r--r--mpz/inp_str.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/mpz/inp_str.c b/mpz/inp_str.c
index 4c1fe35b3..05c8cde90 100644
--- a/mpz/inp_str.c
+++ b/mpz/inp_str.c
@@ -151,9 +151,8 @@ mpz_inp_str_nowhite (mpz_ptr x, FILE *stream, int base, int c, size_t nread)
}
else
{
- xsize = (((mp_size_t)
- (str_size / __mp_bases[base].chars_per_bit_exactly))
- / GMP_NUMB_BITS + 2);
+ xsize = 2 + (mp_size_t)
+ (str_size / (GMP_NUMB_BITS * mp_bases[base].chars_per_bit_exactly));
MPZ_REALLOC (x, xsize);
/* Convert the byte array in base BASE to our bignum format. */