X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb/blobdiff_plain/ab6ce636633a45ab3b1046150b30aee43eca8d42..29e444ad666fee86b3056facafdc1f74c0afe761:/pgen.h diff --git a/pgen.h b/pgen.h index 548fadb8..52e62bbc 100644 --- a/pgen.h +++ b/pgen.h @@ -168,6 +168,42 @@ extern pgen_proc pgen_jump; extern pgen_proc pgen_test; +/*----- Simultaneous primality checking -----------------------------------*/ + +typedef struct pgen_simulprime { + mp *mul, *add; /* Arguments from the client */ + unsigned f; /* Flags, set by client, changed */ +#define PGENF_KEEP 1u /* Keep this prime's value */ +#define PGENF_JUMP 8u /* Use jump table, not stepping */ + pfilt p; /* This prime's filter */ + rabin r; /* Rabin testing context */ + union { + mpw step; /* The simple step to use */ + pfilt *jump; /* The jump to move by */ + mp *x; /* The result, if wanted */ + } u; +} pgen_simulprime; + +typedef struct pgen_simulctx { + pgen_simulprime *v; /* Vector of related primes */ + unsigned n; /* Size of the vector */ + mp *step; /* Basic stepping value */ +} pgen_simulctx; + +/* --- @pgen_simulstep@ --- * + * + * Step a collection of numbers simultaneously. + */ + +extern pgen_proc pgen_simulstep; + +/* --- @pgen_simultest@ --- * + * + * Test a collection of numbers simultaneously. + */ + +extern pgen_proc pgen_simultest; + /*----- Safe prime functions ----------------------------------------------*/ /* --- @pgen_safestep@ --- *