X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/b0ab12e6a6cb035df2b6312df7ad1736af0a6128..75263f25a1ce8e7b38ad4bd61a9a893723ec1db3:/f-prime.c diff --git a/f-prime.c b/f-prime.c index 1a7b9e8..a9673b8 100644 --- a/f-prime.c +++ b/f-prime.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: f-prime.c,v 1.1 2001/04/29 18:12:33 mdw Exp $ + * $Id: f-prime.c,v 1.2 2002/01/13 13:48:44 mdw Exp $ * * Prime fields with Montgomery arithmetic * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: f-prime.c,v $ + * Revision 1.2 2002/01/13 13:48:44 mdw + * Further progress. + * * Revision 1.1 2001/04/29 18:12:33 mdw * Prototype version. * @@ -72,6 +75,12 @@ static mp *fout(field *ff, mp *d, mp *x) return (mpmont_reduce(&f->mm, d, x)); } +static mp *fneg(field *ff, mp *d, mp *x) +{ + fctx *f = (fctx *)ff; + return (mp_sub(d, f->mm.m, x)); +} + static mp *fadd(field *ff, mp *d, mp *x, mp *y) { return (mp_add(d, x, y)); @@ -137,7 +146,7 @@ static mp *fsqrt(field *ff, mp *d, mp *x) static field_ops fops = { fdestroy, fin, fout, - fadd, fsub, fmul, fsqr, finv, freduce, + fneg, fadd, fsub, fmul, fsqr, finv, freduce, fdbl, ftpl, fsqrt };