X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/59b2b448afd977128c84bcea6b18adaf37d4be69..f46efa79cd2bb9adc81541f1218965f85a6b2eef:/gfreduce.c diff --git a/gfreduce.c b/gfreduce.c index 929c46c..4f07ccf 100644 --- a/gfreduce.c +++ b/gfreduce.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: gfreduce.c,v 1.3 2004/03/23 15:19:32 mdw Exp $ + * $Id: gfreduce.c,v 1.4 2004/03/27 00:04:46 mdw Exp $ * * Efficient reduction modulo sparse binary polynomials * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: gfreduce.c,v $ + * Revision 1.4 2004/03/27 00:04:46 mdw + * Implement efficient reduction for pleasant-looking primes. + * * Revision 1.3 2004/03/23 15:19:32 mdw * Test elliptic curves more thoroughly. * @@ -98,7 +101,8 @@ DA_DECL(instr_v, gfreduce_instr); void gfreduce_create(gfreduce *r, mp *p) { instr_v iv = DA_INIT; - unsigned long d, dw; + unsigned long d; + unsigned dw; mpscan sc; unsigned long i; gfreduce_instr *ip; @@ -162,8 +166,8 @@ void gfreduce_create(gfreduce *r, mp *p) w = ww; wi = DA_LEN(&iv); } - INSTR(GFRI_LSL, (i - d)%MPW_BITS); - if ((i - d)%MPW_BITS) + INSTR(GFRI_LSL, (MPW_BITS + i - d)%MPW_BITS); + if ((MPW_BITS + i - d)%MPW_BITS) f |= f_lsr; } wl = DA_LEN(&iv);