/* -*-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
*
/*----- 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.
*
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));
static field_ops fops = {
fdestroy,
fin, fout,
- fadd, fsub, fmul, fsqr, finv, freduce,
+ fneg, fadd, fsub, fmul, fsqr, finv, freduce,
fdbl, ftpl, fsqrt
};