aboutsummaryrefslogtreecommitdiff
path: root/src/math/field.c
diff options
context:
space:
mode:
authorJ08nY2017-03-01 11:33:16 +0100
committerJ08nY2017-03-01 11:33:16 +0100
commitfdd2bbaf35270c5ab63bf3c601ab199f2092ab2c (patch)
tree6bb9eec9d4608545ec6bc61056061f7e92d7c409 /src/math/field.c
parent8c230aa00002b57d47160756a183d65fb895a7b4 (diff)
downloadecgen-fdd2bbaf35270c5ab63bf3c601ab199f2092ab2c.tar.gz
ecgen-fdd2bbaf35270c5ab63bf3c601ab199f2092ab2c.tar.zst
ecgen-fdd2bbaf35270c5ab63bf3c601ab199f2092ab2c.zip
Diffstat (limited to 'src/math/field.c')
-rw-r--r--src/math/field.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/math/field.c b/src/math/field.c
index 983aa09..2d6d358 100644
--- a/src/math/field.c
+++ b/src/math/field.c
@@ -90,6 +90,25 @@ int field_input(curve_t *curve, config_t *config, arg_t *args) {
}
}
+static GEN field = NULL;
+static curve_t *curve_field = NULL;
+
+int field_once(curve_t *curve, config_t *cfg, arg_t *args) {
+ if (field && curve_field == curve) {
+ curve->field = gcopy(field);
+ return 1;
+ }
+
+ int inp = field_input(curve, cfg, args);
+ if (inp > 0) {
+ field = gclone(curve->field);
+ curve_field = curve;
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
GEN field_params(GEN field) {
pari_sp ltop = avma;