static PyObject *fe_pyint(PyObject *x)
{
long l;
+ PyObject *rc;
mp *xx = F_OUT(FE_F(x), MP_NEW, FE_X(x));
- if (mp_tolong_checked(xx, &l)) { MP_DROP(xx); return (0); }
+ if (!mp_tolong_checked(xx, &l, 0)) rc = PyInt_FromLong(l);
+ else rc = mp_topylong(xx);
MP_DROP(xx);
- return (PyInt_FromLong(l));
+ return (rc);
}
static PyObject *fe_pylong(PyObject *x)
Py_TPFLAGS_BASETYPE,
/* @tp_doc@ */
- "Prime fields.",
+"PrimeField(P): prime fields.",
0, /* @tp_traverse@ */
0, /* @tp_clear@ */
Py_TPFLAGS_BASETYPE,
/* @tp_doc@ */
- "Nice prime fields.",
+"NicePrimeField(P): prime field using Solinas reduction.",
0, /* @tp_traverse@ */
0, /* @tp_clear@ */
Py_TPFLAGS_BASETYPE,
/* @tp_doc@ */
- "Binary fields. Abstract class.",
+"Binary fields. Abstract class.",
0, /* @tp_traverse@ */
0, /* @tp_clear@ */
Py_TPFLAGS_BASETYPE,
/* @tp_doc@ */
- "Binary fields with polynomial basis representation.",
+"BinPolyField(P): binary fields with polynomial basis representation.",
0, /* @tp_traverse@ */
0, /* @tp_clear@ */
Py_TPFLAGS_BASETYPE,
/* @tp_doc@ */
- "Binary fields with normal basis representation.",
+"BinNormField(P, BETA): binary fields with normal basis representation.",
0, /* @tp_traverse@ */
0, /* @tp_clear@ */