chiark
/
gitweb
/
~mdw
/
catacomb-python
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
debian/: Use `dh_python2' for packaging.
[catacomb-python]
/
field.c
diff --git
a/field.c
b/field.c
index 2807c1ccbfb6cb491fb5902868548af47f6b203a..35cd452f79a1ae7ae2277693e89198b76a94b9e0 100644
(file)
--- a/
field.c
+++ b/
field.c
@@
-263,10
+263,12
@@
end:
static PyObject *fe_pyint(PyObject *x)
{
long l;
static PyObject *fe_pyint(PyObject *x)
{
long l;
+ PyObject *rc;
mp *xx = F_OUT(FE_F(x), MP_NEW, FE_X(x));
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);
MP_DROP(xx);
- return (
PyInt_FromLong(l)
);
+ return (
rc
);
}
static PyObject *fe_pylong(PyObject *x)
}
static PyObject *fe_pylong(PyObject *x)
@@
-639,7
+641,7
@@
static PyTypeObject primefield_pytype_skel = {
Py_TPFLAGS_BASETYPE,
/* @tp_doc@ */
Py_TPFLAGS_BASETYPE,
/* @tp_doc@ */
-
"P
rime fields.",
+
"PrimeField(P): p
rime fields.",
0, /* @tp_traverse@ */
0, /* @tp_clear@ */
0, /* @tp_traverse@ */
0, /* @tp_clear@ */
@@
-706,7
+708,7
@@
static PyTypeObject niceprimefield_pytype_skel = {
Py_TPFLAGS_BASETYPE,
/* @tp_doc@ */
Py_TPFLAGS_BASETYPE,
/* @tp_doc@ */
-
"Nice prime fields
.",
+
"NicePrimeField(P): prime field using Solinas reduction
.",
0, /* @tp_traverse@ */
0, /* @tp_clear@ */
0, /* @tp_traverse@ */
0, /* @tp_clear@ */
@@
-766,7
+768,7
@@
static PyTypeObject binfield_pytype_skel = {
Py_TPFLAGS_BASETYPE,
/* @tp_doc@ */
Py_TPFLAGS_BASETYPE,
/* @tp_doc@ */
-
"Binary fields. Abstract class.",
+"Binary fields. Abstract class.",
0, /* @tp_traverse@ */
0, /* @tp_clear@ */
0, /* @tp_traverse@ */
0, /* @tp_clear@ */
@@
-839,7
+841,7
@@
static PyTypeObject binpolyfield_pytype_skel = {
Py_TPFLAGS_BASETYPE,
/* @tp_doc@ */
Py_TPFLAGS_BASETYPE,
/* @tp_doc@ */
-
"B
inary fields with polynomial basis representation.",
+
"BinPolyField(P): b
inary fields with polynomial basis representation.",
0, /* @tp_traverse@ */
0, /* @tp_clear@ */
0, /* @tp_traverse@ */
0, /* @tp_clear@ */
@@
-921,7
+923,7
@@
static PyTypeObject binnormfield_pytype_skel = {
Py_TPFLAGS_BASETYPE,
/* @tp_doc@ */
Py_TPFLAGS_BASETYPE,
/* @tp_doc@ */
-
"B
inary fields with normal basis representation.",
+
"BinNormField(P, BETA): b
inary fields with normal basis representation.",
0, /* @tp_traverse@ */
0, /* @tp_clear@ */
0, /* @tp_traverse@ */
0, /* @tp_clear@ */