diff options
author | Kevin Ryde <user42@zip.com.au> | 2000-10-27 01:05:41 +0200 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2000-10-27 01:05:41 +0200 |
commit | 12cee66fabd7a0e4c8268326317319aeceaa4f08 (patch) | |
tree | 076d4ed71b24dda94d6d093af973154b858ea639 /mpz/fib_ui.c | |
parent | 49847dfa73fda07b1978e61e258c3de40b1d3087 (diff) | |
download | gmp-12cee66fabd7a0e4c8268326317319aeceaa4f08.tar.gz |
Fix for:
* mpz/fib_ui.c: Rewrite, same formulas but using mpn functions and
some lookup tables, much faster at small to moderate sizes.
Add some "static"s for the data tables.
"One mistake on initial checkin is a misfortune, two looks like carelessness."
-- O. Wilde
Diffstat (limited to 'mpz/fib_ui.c')
-rw-r--r-- | mpz/fib_ui.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/mpz/fib_ui.c b/mpz/fib_ui.c index 022da7cd1..07d8f9634 100644 --- a/mpz/fib_ui.c +++ b/mpz/fib_ui.c @@ -60,7 +60,7 @@ MA 02111-1307, USA. */ table2[i][0] is the low limb, table2[i][1] the high limb. */ #if BITS_PER_MP_LIMB == 32 -const mp_limb_t table1[] = { +static const mp_limb_t table1[] = { CNST_LIMB (0), /* 0 */ CNST_LIMB (1), /* 1 */ CNST_LIMB (1), /* 2 */ @@ -110,7 +110,7 @@ const mp_limb_t table1[] = { CNST_LIMB (1836311903), /* 46 */ CNST_LIMB (2971215073), /* 47 */ }; -const mp_limb_t table2[][2] = { +static const mp_limb_t table2[][2] = { {CNST_LIMB(512559680), CNST_LIMB(1)}, /* 48 */ {CNST_LIMB(3483774753), CNST_LIMB(1)}, /* 49 */ {CNST_LIMB(3996334433), CNST_LIMB(2)}, /* 50 */ @@ -161,7 +161,7 @@ const mp_limb_t table2[][2] = { #endif #if BITS_PER_MP_LIMB == 64 -const mp_limb_t table1[] = { +static const mp_limb_t table1[] = { CNST_LIMB (0), /* 0 */ CNST_LIMB (1), /* 1 */ CNST_LIMB (1), /* 2 */ @@ -257,7 +257,7 @@ const mp_limb_t table1[] = { CNST_LIMB (7540113804746346429), /* 92 */ CNST_LIMB (12200160415121876738), /* 93 */ }; -const mp_limb_t table2[][2] = { +static const mp_limb_t table2[][2] = { {CNST_LIMB(1293530146158671551), CNST_LIMB(1)}, /* 94 */ {CNST_LIMB(13493690561280548289), CNST_LIMB(1)}, /* 95 */ {CNST_LIMB(14787220707439219840), CNST_LIMB(2)}, /* 96 */ @@ -659,7 +659,7 @@ generate (int bpml) mpz_init (lo); printf ("#if BITS_PER_MP_LIMB == %d\n", bpml); - printf ("const mp_limb_t table1[] = {\n"); + printf ("static const mp_limb_t table1[] = {\n"); /* at n==0 */ mpz_init_set_ui (fn1, 1); /* F[n-1] */ @@ -670,7 +670,7 @@ generate (int bpml) if (mpz_sizeinbase(fn,2) > bpml && mpz_sizeinbase(fn1,2) <= bpml) { printf ("};\n"); - printf ("const mp_limb_t table2[][2] = {\n"); + printf ("static const mp_limb_t table2[][2] = {\n"); } if (mpz_sizeinbase(fn,2) <= bpml) |