diff options
| author | J08nY | 2017-09-29 18:34:06 +0200 |
|---|---|---|
| committer | J08nY | 2017-09-29 18:34:06 +0200 |
| commit | 0c2b270e5e5934bb4426bc526e6d50d4e9720909 (patch) | |
| tree | 1f55cc2e4e886bb361067ca10068dd9c7fae8f34 /src/gen | |
| parent | 73ae939ffee2c0fc027d9ac5d07b479d8e967a8c (diff) | |
| download | ecgen-0c2b270e5e5934bb4426bc526e6d50d4e9720909.tar.gz ecgen-0c2b270e5e5934bb4426bc526e6d50d4e9720909.tar.zst ecgen-0c2b270e5e5934bb4426bc526e6d50d4e9720909.zip | |
Introduce HAS_ARG(args) macro.
Diffstat (limited to 'src/gen')
| -rw-r--r-- | src/gen/gens.c | 4 | ||||
| -rw-r--r-- | src/gen/order.c | 7 | ||||
| -rw-r--r-- | src/gen/point.c | 11 |
3 files changed, 6 insertions, 16 deletions
diff --git a/src/gen/gens.c b/src/gen/gens.c index f5336df..11f6611 100644 --- a/src/gen/gens.c +++ b/src/gen/gens.c @@ -37,9 +37,7 @@ GENERATOR(gens_gen_one) { return gens_put(curve, generators, len); } -CHECK(gens_check_cofactor) { - return INT_MIN; -} +CHECK(gens_check_cofactor) { return INT_MIN; } UNROLL(gens_unroll) { if (curve->generators) { diff --git a/src/gen/order.c b/src/gen/order.c index 891c95b..2e20294 100644 --- a/src/gen/order.c +++ b/src/gen/order.c @@ -3,6 +3,7 @@ * Copyright (C) 2017 J08nY */ #include "order.h" +#include "exhaustive/arg.h" #include "io/input.h" #include "io/output.h" @@ -43,11 +44,7 @@ GENERATOR(order_gen_sea) { } GENERATOR(order_gen_smallfact) { - if (!args) { - fprintf(err, "No args to an arged function. order_gen_smallfact\n"); - return INT_MIN; - } - + HAS_ARG(args); pari_ulong smallfact = *(pari_ulong *)args->args; pari_sp ltop = avma; GEN fact = mpfact(smallfact); diff --git a/src/gen/point.c b/src/gen/point.c index 11561fb..61ca7e1 100644 --- a/src/gen/point.c +++ b/src/gen/point.c @@ -3,6 +3,7 @@ * Copyright (C) 2017 J08nY */ #include "point.h" +#include "exhaustive/arg.h" #include "io/output.h" #include "math/subgroups.h" #include "util/memory.h" @@ -103,10 +104,7 @@ GENERATOR(point_gen_random) { } GENERATOR(points_gen_random) { - if (!args) { - fprintf(err, "No args to an arged function. points_gen_random\n"); - return INT_MIN; - } + HAS_ARG(args); size_t npoints = *(size_t *)args->args; @@ -160,10 +158,7 @@ static int points_from_orders(curve_t *curve, GEN orders) { } GENERATOR(points_gen_trial) { - if (!args) { - fprintf(err, "No args to an arged function. points_gen_trial\n"); - return INT_MIN; - } + HAS_ARG(args); pari_ulong *primes = (pari_ulong *)args->args; size_t nprimes = args->nargs; |
