summaryrefslogtreecommitdiff
path: root/gen-fac.c
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2012-04-30 16:02:11 +0200
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2012-04-30 16:02:11 +0200
commit7534012a4efa3d7f269891b7614b212398914e9d (patch)
treee3f06b9eb059936fe2ddf1c5ab9c79e17e0fe1bb /gen-fac.c
parent78d7dd516a6121a5323cda6c79b8736e9d16774e (diff)
downloadgmp-7534012a4efa3d7f269891b7614b212398914e9d.tar.gz
Share precomputed (n-popcount(n)).
Diffstat (limited to 'gen-fac.c')
-rw-r--r--gen-fac.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gen-fac.c b/gen-fac.c
index 398addef0..9ec5727a0 100644
--- a/gen-fac.c
+++ b/gen-fac.c
@@ -178,18 +178,23 @@ gen_consts (int numb, int nail, int limb)
}
printf (")\n");
+ ofe = (ofe / 16 + 1) * 16;
+
printf
("\n/* This table contains 1i-popc(2i) for small i */\n");
printf
("\n/* It begins with 2-1=1 (N=1) */\n");
printf
("#define TABLE_2N_MINUS_POPC_2N 1");
- for (b = 4;b <= ofe + 1; b+=2)
+ for (b = 4; b <= ofe; b += 2)
{
mpz_set_ui (x, b);
printf (",%lu",b - mpz_popcount (x));
}
printf ("\n");
+ printf
+ ("#define TABLE_LIMIT_2N_MINUS_POPC_2N %i\n", ofe + 1);
+
ofl = (ofl + 1) / 2;
printf