-extern int pgen_test(int /*rq*/, pgen_event */*ev*/, void */*p*/);
-
-/*----- Safe prime functions ----------------------------------------------*/
-
-/* --- @pgen_safestep@ --- *
- *
- * Steps two numbers, %$q$% and %$p = 2q + 1$%, such that neither has any
- * small factors. %$p$% is put in the event block.
- */
-
-typedef struct pgen_safestepctx {
- pfilt q, p;
-} pgen_safestepctx;
-
-extern int pgen_safestep(int /*rq*/, pgen_event */*ev*/, void */*p*/);
-
-/* --- @pgen_safejump@ --- *
- *
- * Jumps two numbers, %$q$% and %$p = 2q + 1$% such that neither has any
- * small factors.
+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.