diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2018-11-23 09:32:39 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2018-11-23 09:32:39 +0000 |
commit | b0d6a60109becacd0ef1f3fd157503f87e9ebc7c (patch) | |
tree | 6c075c3fb5048f1e13265806255cfd24b4193efd /src/strtofr.c | |
parent | e76e8cf887a704f1c417a242197b02c00e552d0e (diff) | |
download | mpfr-b0d6a60109becacd0ef1f3fd157503f87e9ebc7c.tar.gz |
[src/strtofr.c] Changed some unsigned long to unsigned int.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13292 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/strtofr.c')
-rw-r--r-- | src/strtofr.c | 133 |
1 files changed, 67 insertions, 66 deletions
diff --git a/src/strtofr.c b/src/strtofr.c index b2ba8a9a0..3efe87b5e 100644 --- a/src/strtofr.c +++ b/src/strtofr.c @@ -45,70 +45,71 @@ struct parsed_string { /* This table has been generated by the following program. For 2 <= b <= MPFR_MAX_BASE, RedInvLog2Table[b-2][0] / RedInvLog2Table[b-2][1] - is an upper approximation of log(2)/log(b). + is an upper approximation to log(2)/log(b), no larger than 1. + Note: these numbers must fit on 16 bits, thus unsigned int is OK. */ -static const unsigned long RedInvLog2Table[MPFR_MAX_BASE-1][2] = { - {1UL, 1UL}, - {53UL, 84UL}, - {1UL, 2UL}, - {4004UL, 9297UL}, - {53UL, 137UL}, - {2393UL, 6718UL}, - {1UL, 3UL}, - {665UL, 2108UL}, - {4004UL, 13301UL}, - {949UL, 3283UL}, - {53UL, 190UL}, - {5231UL, 19357UL}, - {2393UL, 9111UL}, - {247UL, 965UL}, - {1UL, 4UL}, - {4036UL, 16497UL}, - {665UL, 2773UL}, - {5187UL, 22034UL}, - {4004UL, 17305UL}, - {51UL, 224UL}, - {949UL, 4232UL}, - {3077UL, 13919UL}, - {53UL, 243UL}, - {73UL, 339UL}, - {5231UL, 24588UL}, - {665UL, 3162UL}, - {2393UL, 11504UL}, - {4943UL, 24013UL}, - {247UL, 1212UL}, - {3515UL, 17414UL}, - {1UL, 5UL}, - {4415UL, 22271UL}, - {4036UL, 20533UL}, - {263UL, 1349UL}, - {665UL, 3438UL}, - {1079UL, 5621UL}, - {5187UL, 27221UL}, - {2288UL, 12093UL}, - {4004UL, 21309UL}, - {179UL, 959UL}, - {51UL, 275UL}, - {495UL, 2686UL}, - {949UL, 5181UL}, - {3621UL, 19886UL}, - {3077UL, 16996UL}, - {229UL, 1272UL}, - {53UL, 296UL}, - {109UL, 612UL}, - {73UL, 412UL}, - {1505UL, 8537UL}, - {5231UL, 29819UL}, - {283UL, 1621UL}, - {665UL, 3827UL}, - {32UL, 185UL}, - {2393UL, 13897UL}, - {1879UL, 10960UL}, - {4943UL, 28956UL}, - {409UL, 2406UL}, - {247UL, 1459UL}, - {231UL, 1370UL}, - {3515UL, 20929UL} }; +static const unsigned int RedInvLog2Table[MPFR_MAX_BASE-1][2] = { + {1, 1}, + {53, 84}, + {1, 2}, + {4004, 9297}, + {53, 137}, + {2393, 6718}, + {1, 3}, + {665, 2108}, + {4004, 13301}, + {949, 3283}, + {53, 190}, + {5231, 19357}, + {2393, 9111}, + {247, 965}, + {1, 4}, + {4036, 16497}, + {665, 2773}, + {5187, 22034}, + {4004, 17305}, + {51, 224}, + {949, 4232}, + {3077, 13919}, + {53, 243}, + {73, 339}, + {5231, 24588}, + {665, 3162}, + {2393, 11504}, + {4943, 24013}, + {247, 1212}, + {3515, 17414}, + {1, 5}, + {4415, 22271}, + {4036, 20533}, + {263, 1349}, + {665, 3438}, + {1079, 5621}, + {5187, 27221}, + {2288, 12093}, + {4004, 21309}, + {179, 959}, + {51, 275}, + {495, 2686}, + {949, 5181}, + {3621, 19886}, + {3077, 16996}, + {229, 1272}, + {53, 296}, + {109, 612}, + {73, 412}, + {1505, 8537}, + {5231, 29819}, + {283, 1621}, + {665, 3827}, + {32, 185}, + {2393, 13897}, + {1879, 10960}, + {4943, 28956}, + {409, 2406}, + {247, 1459}, + {231, 1370}, + {3515, 20929} }; #if 0 #define N 8 int main () @@ -528,11 +529,11 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mpfr_rnd_t rnd) Hence the allocation above for ysize + extra_limbs limbs. */ { - unsigned long Num = RedInvLog2Table[pstr->base-2][0]; - unsigned long Den = RedInvLog2Table[pstr->base-2][1]; + unsigned int Num = RedInvLog2Table[pstr->base-2][0]; + unsigned int Den = RedInvLog2Table[pstr->base-2][1]; MPFR_ASSERTD (Num <= Den && Den <= 65535); /* thus no overflow */ pstr_size = (ysize_bits / Den) * Num - + ((ysize_bits % Den) * Num + Den - 1) / Den + + ((unsigned long) (ysize_bits % Den) * Num + Den - 1) / Den + 1; } |