YoushouldhavereceivedcopiesoftheGNUGeneralPublicLicenseandthe GNULesserGeneralPublicLicensealongwiththeGNUMPLibrary.Ifnot,
see https://www.gnu.org/licenses/. */
int
generate (int limb_bits, int limit)
{
mpz_t limb; int i, lb, pc, c, totpc, maxprime;
mpz_init (limb);
printf ("/* This file generated by gen-sieve.c - DO NOT EDIT. */\n");
printf ("\n");
printf ("#if GMP_LIMB_BITS != %d\n", limb_bits);
printf ("Error, error, this data is for %d bits\n", limb_bits);
printf ("#endif\n");
printf ("\n");
printf ("#define PRIMESIEVE_INIT_TABLE ");
maxprime = 3;
lb = pc = c = totpc = 0; for (i = 0; i < limit; i++)
{ if (! isprime (bit_to_n (i)))
mpz_setbit (limb, lb); else
maxprime = bit_to_n (i), ++pc;
++lb; if (lb == limb_bits)
{
++c;
printf ("\\\n\tCNST_LIMB (0x");
mpz_out_str (stdout, -16, limb);
printf ("),\t/* %d - %d (%d primes) */\t", bit_to_n (i + 1 - limb_bits),
bit_to_n (i + 1) - 1, pc);
totpc += pc;
lb = pc = 0;
mpz_set_ui (limb, 0);
}
}
void
setmask (mpz_t mask, int a, int b)
{
mpz_set_ui (mask, 0); for (unsigned i = 0; i < 2 * a * b; ++i) if ((bit_to_n (i) % a == 0) || (bit_to_n (i) % b == 0))
mpz_setbit (mask, i);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.