use enum type

This commit is contained in:
Francois Perrad 2019-10-19 17:14:46 +02:00
parent b34aac09cb
commit e33311a1fe
8 changed files with 22 additions and 14 deletions

View File

@ -8,7 +8,7 @@ int main(void)
{ {
char buf[2000]; char buf[2000];
size_t x; size_t x;
int y; mp_bool y;
mp_int q, p; mp_int q, p;
FILE *out; FILE *out;
clock_t t1; clock_t t1;

View File

@ -5,7 +5,8 @@ static int sizes[] = { 1+256/MP_DIGIT_BIT, 1+512/MP_DIGIT_BIT, 1+768/MP_DIGIT_BI
int main(void) int main(void)
{ {
int res, x, y; mp_bool res;
int x, y;
char buf[4096]; char buf[4096];
FILE *out; FILE *out;
mp_int a, b; mp_int a, b;

View File

@ -5,10 +5,11 @@
#include <time.h> #include <time.h>
#include <tommath.h> #include <tommath.h>
static int is_mersenne(long s, int *pp) static mp_err is_mersenne(long s, mp_bool *pp)
{ {
mp_int n, u; mp_int n, u;
int res, k; mp_err res;
int k;
*pp = 0; *pp = 0;
@ -102,7 +103,7 @@ static int isprime(long k)
int main(void) int main(void)
{ {
int pp; mp_bool pp;
long k; long k;
clock_t tt; clock_t tt;

View File

@ -179,10 +179,11 @@ static mp_digit prime_digit(void)
/* makes a prime of at least k bits */ /* makes a prime of at least k bits */
static int pprime(int k, int li, mp_int *p, mp_int *q) static mp_err pprime(int k, int li, mp_int *p, mp_int *q)
{ {
mp_int a, b, c, n, x, y, z, v; mp_int a, b, c, n, x, y, z, v;
int res, ii; mp_err res;
int ii;
static const mp_digit bases[] = { 2, 3, 5, 7, 11, 13, 17, 19 }; static const mp_digit bases[] = { 2, 3, 5, 7, 11, 13, 17, 19 };
/* single digit ? */ /* single digit ? */

View File

@ -61,7 +61,8 @@ static int s_offset = 1;
#define s_mp_mul(a, b, c) s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1) #define s_mp_mul(a, b, c) s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1)
static uint64_t s_time_mul(int size) static uint64_t s_time_mul(int size)
{ {
int x, e; int x;
mp_err e;
mp_int a, b, c, d; mp_int a, b, c, d;
uint64_t t1; uint64_t t1;
@ -106,7 +107,8 @@ LBL_ERR:
static uint64_t s_time_sqr(int size) static uint64_t s_time_sqr(int size)
{ {
int x, e; int x;
mp_err e;
mp_int a, b, c; mp_int a, b, c;
uint64_t t1; uint64_t t1;

View File

@ -10,9 +10,10 @@
*/ */
mp_err mp_prime_next_prime(mp_int *a, int t, int bbs_style) mp_err mp_prime_next_prime(mp_int *a, int t, int bbs_style)
{ {
int x, y, cmp; int x, y;
mp_err err; mp_ord cmp;
mp_bool res = MP_NO; mp_err err;
mp_bool res = MP_NO;
mp_digit res_tab[MP_PRIME_TAB_SIZE], step, kstep; mp_digit res_tab[MP_PRIME_TAB_SIZE], step, kstep;
mp_int b; mp_int b;

View File

@ -32,7 +32,8 @@
mp_err s_mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c) mp_err s_mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c)
{ {
mp_int S1, S2, T1, a0, a1, a2, b0, b1, b2; mp_int S1, S2, T1, a0, a1, a2, b0, b1, b2;
int err, B, count; int B, count;
mp_err err;
/* init temps */ /* init temps */
if ((err = mp_init_multi(&S1, &S2, &T1, NULL)) != MP_OKAY) { if ((err = mp_init_multi(&S1, &S2, &T1, NULL)) != MP_OKAY) {

View File

@ -22,7 +22,8 @@ mp_err s_mp_toom_sqr(const mp_int *a, mp_int *b)
{ {
mp_int S0, a0, a1, a2; mp_int S0, a0, a1, a2;
mp_digit *tmpa, *tmpc; mp_digit *tmpa, *tmpc;
mp_err err, B, count; int B, count;
mp_err err;
/* init temps */ /* init temps */