/* -*-c-*-
*
- * $Id: pfilt.c,v 1.4 2000/10/08 12:14:57 mdw Exp $
+ * $Id: pfilt.c,v 1.5 2004/04/01 12:50:09 mdw Exp $
*
* Finding and testing prime numbers
*
/*----- Revision history --------------------------------------------------*
*
* $Log: pfilt.c,v $
+ * Revision 1.5 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.4 2000/10/08 12:14:57 mdw
* Remove vestiges of @primorial@.
*
int rc = PGEN_TRY;
int i;
size_t sz = MP_LEN(m);
- mpw *v = mpalloc(m->a, sz);
+ mparena *a = m->a ? m->a : MPARENA_GLOBAL;
+ mpw *v = mpalloc(a, sz);
/* --- Fill in the residues --- */
/* --- Done --- */
- mpfree(m->a, v);
+ mpfree(a, v);
return (rc);
}
int rc = PGEN_TRY;
int i;
size_t sz = MP_LEN(m);
- mpw *v = mpalloc(m->a, sz);
+ mparena *a = m->a ? m->a : MPARENA_GLOBAL;
+ mpw *v = mpalloc(a, sz);
/* --- Take a copy of the number --- */
/* --- Done --- */
- mpfree(m->a, v);
+ mpfree(a, v);
return (rc);
}