aboutsummaryrefslogtreecommitdiff
path: root/src/math/equation.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/math/equation.c')
-rw-r--r--src/math/equation.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/math/equation.c b/src/math/equation.c
index 2f57d03..45b849b 100644
--- a/src/math/equation.c
+++ b/src/math/equation.c
@@ -17,26 +17,28 @@ int a_input(curve_t *curve, config_t *config, arg_t *args) {
avma = ltop;
return 0;
}
- curve->a = gerepilecopy(ltop, inp);
+ curve->a = inp;
// TODO change a to a field element here?. a t_INTMOD or a t_FFELT.
return 1;
}
static GEN a = NULL;
+static curve_t *curve_a = NULL;
int a_once(curve_t *curve, config_t *config, arg_t *args) {
- if (a) {
+ if (a && curve_a == curve) {
curve->a = gcopy(a);
return 1;
}
int inp = a_input(curve, config, args);
- if (inp) {
+ if (inp > 0) {
a = gclone(curve->a);
+ curve_a = curve;
+ return 1;
} else {
return 0;
}
- return 1;
}
int a_zero(curve_t *curve, config_t *config, arg_t *args) {
@@ -66,26 +68,28 @@ int b_input(curve_t *curve, config_t *config, arg_t *args) {
avma = ltop;
return 0;
}
- curve->b = gerepilecopy(ltop, inp);
+ curve->b = inp;
// TODO change b to a field element here?. a t_INTMOD or a t_FFELT.
return 1;
}
static GEN b = NULL;
+static curve_t* curve_b = NULL;
int b_once(curve_t *curve, config_t *config, arg_t *args) {
- if (b) {
+ if (b && curve_b == curve) {
curve->b = gcopy(b);
return 1;
}
int inp = b_input(curve, config, args);
- if (inp) {
+ if (inp > 0) {
b = gclone(curve->b);
+ curve_b = curve;
+ return 1;
} else {
return 0;
}
- return 1;
}
int b_zero(curve_t *curve, config_t *config, arg_t *args) {