X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/9a8b0c8d33c593353185871b581bc8f5be8600fb..34e4f738bcba58e6d8c4cabbb0b3232a65b42a9d:/pfilt.h diff --git a/pfilt.h b/pfilt.h index e3461d2..963b765 100644 --- a/pfilt.h +++ b/pfilt.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: pfilt.h,v 1.1 1999/12/22 15:49:39 mdw Exp $ + * $Id: pfilt.h,v 1.3 2004/04/01 12:50:09 mdw Exp $ * * Finding and testing prime numbers * @@ -30,6 +30,17 @@ /*----- Revision history --------------------------------------------------* * * $Log: pfilt.h,v $ + * Revision 1.3 2004/04/01 12:50:09 mdw + * Add cyclic group abstraction, with test code. Separate off exponentation + * functions for better static linking. Fix a buttload of bugs on the way. + * Generally ensure that negative exponents do inversion correctly. Add + * table of standard prime-field subgroups. (Binary field subgroups are + * currently unimplemented but easy to add if anyone ever finds a good one.) + * + * Revision 1.2 2000/08/15 21:42:56 mdw + * Use the small primes type from `genprimes' output. New function for + * doing trial division the hard way. + * * Revision 1.1 1999/12/22 15:49:39 mdw * Renamed from `pgen'. Reworking for new prime-search system. * @@ -57,7 +68,7 @@ # include "mp.h" #endif -#ifndef CATACOMB_PTAB_H +#ifndef CATACOMB_PRIMETAB_H # include "primetab.h" #endif @@ -65,11 +76,24 @@ typedef struct pfilt { mp *m; - unsigned char r[NPRIME]; + smallprime r[NPRIME]; } pfilt; /*----- Functions provided ------------------------------------------------*/ +/* --- @pfilt_smallfactor@ --- * + * + * Arguments: @mp *m@ = integer to test + * + * Returns: One of the @PGEN@ result codes. + * + * Use: Tests a number by dividing by a number of small primes. This + * is a useful first step if you're testing random primes; for + * sequential searches, @pfilt_create@ works better. + */ + +extern int pfilt_smallfactor(mp */*m*/); + /* --- @pfilt_create@ --- * * * Arguments: @pfilt *p@ = pointer to prime filtering context