diff options
| author | J08nY | 2017-06-01 01:46:25 +0200 |
|---|---|---|
| committer | J08nY | 2017-06-01 01:46:25 +0200 |
| commit | 261e0ce6530387db48a07c3f8925dd67e63c28bf (patch) | |
| tree | 6f41122a982f13a0ba828d7ade2b8af326546ae3 /src/exhaustive | |
| parent | 63427ed3415b25bd29c5e1fe71ef9883d955bfcf (diff) | |
| download | ecgen-261e0ce6530387db48a07c3f8925dd67e63c28bf.tar.gz ecgen-261e0ce6530387db48a07c3f8925dd67e63c28bf.tar.zst ecgen-261e0ce6530387db48a07c3f8925dd67e63c28bf.zip | |
Renamed a bunch of generators.
Diffstat (limited to 'src/exhaustive')
| -rw-r--r-- | src/exhaustive/anomalous.c | 9 | ||||
| -rw-r--r-- | src/exhaustive/anomalous.h | 8 | ||||
| -rw-r--r-- | src/exhaustive/exhaustive.c | 14 |
3 files changed, 16 insertions, 15 deletions
diff --git a/src/exhaustive/anomalous.c b/src/exhaustive/anomalous.c index 89cc89c..507d8ca 100644 --- a/src/exhaustive/anomalous.c +++ b/src/exhaustive/anomalous.c @@ -87,7 +87,7 @@ static GEN anomalous_c(size_t i, GEN p) { return gerepilecopy(ltop, c); } -int anomalous_field(curve_t *curve, const config_t *cfg, arg_t *args) { +GENERATOR(anomalous_gen_field) { if (!args) { fprintf(stderr, "No args to an arged function. anomalous_field\n"); return INT_MIN; @@ -106,9 +106,10 @@ int anomalous_field(curve_t *curve, const config_t *cfg, arg_t *args) { return 1; } -int anomalous_equation(curve_t *curve, const config_t *cfg, arg_t *args) { +GENERATOR(anomalous_gen_equation) { if (!args) { - fprintf(stderr, "No args to an arged function. anomalous_equation\n"); + fprintf(stderr, + "No args to an arged function. anomalous_gen_equation\n"); return INT_MIN; } size_t i = *(size_t *)args->args; @@ -126,7 +127,7 @@ int anomalous_equation(curve_t *curve, const config_t *cfg, arg_t *args) { return 1; } -int anomalous_order(curve_t *curve, const config_t *cfg, arg_t *args) { +GENERATOR(anomalous_gen_order) { // copy field to order curve->order = gcopy(curve->field); obj_insert(curve->curve, 1, curve->order); diff --git a/src/exhaustive/anomalous.h b/src/exhaustive/anomalous.h index 9111919..ff6c053 100644 --- a/src/exhaustive/anomalous.h +++ b/src/exhaustive/anomalous.h @@ -9,9 +9,9 @@ #define ECGEN_ANOMALOUS_H #include <pari/pari.h> -#include "io/cli.h" #include "arg.h" #include "gen/types.h" +#include "io/cli.h" typedef struct disc_t { GEN d; @@ -27,7 +27,7 @@ typedef struct disc_t { * @param args the index of the discriminant to use, in the disc_table * @return state diff */ -int anomalous_field(curve_t *curve, const config_t *cfg, arg_t *args); +GENERATOR(anomalous_gen_field); /** * GENERATOR(gen_t) @@ -37,7 +37,7 @@ int anomalous_field(curve_t *curve, const config_t *cfg, arg_t *args); * @param args the index of the discriminant to use, in the disc_table * @return state diff */ -int anomalous_equation(curve_t *curve, const config_t *cfg, arg_t *args); +GENERATOR(anomalous_gen_equation); /** * GENERATOR(gen_t) @@ -47,7 +47,7 @@ int anomalous_equation(curve_t *curve, const config_t *cfg, arg_t *args); * @param args unused * @return state diff */ -int anomalous_order(curve_t *curve, const config_t *cfg, arg_t *args); +GENERATOR(anomalous_gen_order); /** * @brief Initialize anomalous generation, allocate and set the disc_table. diff --git a/src/exhaustive/exhaustive.c b/src/exhaustive/exhaustive.c index 5c50a71..d9b9a6a 100644 --- a/src/exhaustive/exhaustive.c +++ b/src/exhaustive/exhaustive.c @@ -4,7 +4,6 @@ */ #include "exhaustive.h" #include "anomalous.h" -#include "io/output.h" #include "gen/curve.h" #include "gen/equation.h" #include "gen/field.h" @@ -12,18 +11,19 @@ #include "gen/order.h" #include "gen/point.h" #include "gen/seed.h" +#include "io/output.h" #include "util/memory.h" static void exhaustive_ginit(gen_t *generators, const config_t *cfg) { if (cfg->from_seed) { // setup ANSI X9.62 generators if (cfg->seed) { - generators[OFFSET_SEED] = &seed_argument; + generators[OFFSET_SEED] = &seed_gen_argument; } else { if (cfg->random) { - generators[OFFSET_SEED] = &seed_random; + generators[OFFSET_SEED] = &seed_gen_random; } else { - generators[OFFSET_SEED] = &seed_input; + generators[OFFSET_SEED] = &seed_gen_input; } } generators[OFFSET_A] = &a_gen_seed; @@ -35,7 +35,7 @@ static void exhaustive_ginit(gen_t *generators, const config_t *cfg) { if (cfg->anomalous) { generators[OFFSET_A] = &gen_skip; - generators[OFFSET_B] = &anomalous_equation; + generators[OFFSET_B] = &anomalous_gen_equation; } else if (cfg->random) { generators[OFFSET_A] = &a_gen_random; generators[OFFSET_B] = &b_gen_random; @@ -55,7 +55,7 @@ static void exhaustive_ginit(gen_t *generators, const config_t *cfg) { } else if (cfg->cofactor) { generators[OFFSET_ORDER] = &order_gen_smallfact; } else if (cfg->anomalous) { - generators[OFFSET_ORDER] = &anomalous_order; + generators[OFFSET_ORDER] = &anomalous_gen_order; } else { generators[OFFSET_ORDER] = &order_gen_any; } @@ -69,7 +69,7 @@ static void exhaustive_ginit(gen_t *generators, const config_t *cfg) { } if (cfg->anomalous) { - generators[OFFSET_FIELD] = &anomalous_field; + generators[OFFSET_FIELD] = &anomalous_gen_field; } else if (cfg->random) { generators[OFFSET_FIELD] = &field_gen_random; } else { |
