X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/383e235b5f9f031f93af4795a1162909577a4d74..07290a455e008c37adc233554eff8ad468608161:/limlee.c diff --git a/limlee.c b/limlee.c index 3f8435b..b6fc4d6 100644 --- a/limlee.c +++ b/limlee.c @@ -1,13 +1,13 @@ /* -*-c-*- * - * $Id: limlee.c,v 1.8 2001/02/03 11:59:07 mdw Exp $ + * $Id: limlee.c,v 1.9 2004/04/08 01:36:15 mdw Exp $ * * Generate Lim-Lee primes * * (c) 2000 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of Catacomb. * @@ -15,50 +15,18 @@ * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * + * * Catacomb is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. - * + * * You should have received a copy of the GNU Library General Public * License along with Catacomb; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: limlee.c,v $ - * Revision 1.8 2001/02/03 11:59:07 mdw - * Don't use the @pgen@ random number generator for generating primes: it's - * only for testing them. Use a caller-supplied one instead. - * - * Revision 1.7 2001/01/25 21:40:44 mdw - * Remove dead code now that the new stepper structure is trustworthy. - * - * Revision 1.6 2001/01/25 21:16:20 mdw - * Boring cosmetic stuff. - * - * Revision 1.5 2000/08/18 19:16:51 mdw - * New stepper interface for constructing Lim-Lee primes. - * - * Revision 1.4 2000/08/15 21:45:05 mdw - * Use the new trial division equipment in pfilt. This gives a 10% - * performance improvement in dsa-gen.t. - * - * Revision 1.3 2000/07/29 09:58:32 mdw - * (limlee): Bug fix. Old versions didn't set the filter step if @ql@ was - * an exact divisor of @pl@. - * - * Revision 1.2 2000/07/26 18:00:00 mdw - * No footer line! - * - * Revision 1.1 2000/07/09 21:30:58 mdw - * Lim-Lee prime generation. - * - */ - /*----- Header files ------------------------------------------------------*/ #include @@ -227,7 +195,7 @@ static int init(pgen_event *ev, limlee_stepctx *l) else { dstr_putf(&l->d, "%s*", ev->name); l->pops->pgen(&l->qq, qql, l); - } + } return (PGEN_TRY); } @@ -363,7 +331,7 @@ int limlee_step(int rq, pgen_event *ev, void *p) return (done(ev, l)); } return (PGEN_ABORT); -} +} /*----- Main code ---------------------------------------------------------*/ @@ -413,7 +381,7 @@ mp *limlee(const char *name, mp *d, mp *newp, d = pgen(name, d, 0, oev, oec, on, limlee_step, &l, rabin_iters(pl), pgen_test, &rr); - if (f) { + if (d && f) { mp **v; size_t i; v = xmalloc(l.nf * sizeof(mp *));