Commit a1ab90be3cc6c7c473f9207a4f59a9885b728327

Francois Perrad 2019-10-19T17:10:30

use enum value

diff --git a/etc/2kprime.c b/etc/2kprime.c
index fe25da3..95ed2de 100644
--- a/etc/2kprime.c
+++ b/etc/2kprime.c
@@ -43,7 +43,7 @@ top:
 
             /* quick test on q */
             mp_prime_is_prime(&q, 1, &y);
-            if (y == 0) {
+            if (y == MP_NO) {
                continue;
             }
 
@@ -51,20 +51,20 @@ top:
             mp_sub_d(&q, 1uL, &p);
             mp_div_2(&p, &p);
             mp_prime_is_prime(&p, 3, &y);
-            if (y == 0) {
+            if (y == MP_NO) {
                continue;
             }
 
             /* test on q */
             mp_prime_is_prime(&q, 3, &y);
-            if (y == 0) {
+            if (y == MP_NO) {
                continue;
             }
 
             break;
          }
 
-         if (y == 0) {
+         if (y == MP_NO) {
             ++sizes[x];
             goto top;
          }
diff --git a/etc/drprime.c b/etc/drprime.c
index 73838c4..64e31ef 100644
--- a/etc/drprime.c
+++ b/etc/drprime.c
@@ -30,23 +30,23 @@ top:
          a.used = sizes[x];
 
          /* now loop */
-         res = 0;
+         res = MP_NO;
          for (;;) {
             a.dp[0] += 4uL;
             if (a.dp[0] >= MP_MASK) break;
             mp_prime_is_prime(&a, 1, &res);
-            if (res == 0) continue;
+            if (res == MP_NO) continue;
             printf(".");
             fflush(stdout);
             mp_sub_d(&a, 1uL, &b);
             mp_div_2(&b, &b);
             mp_prime_is_prime(&b, 3, &res);
-            if (res == 0) continue;
+            if (res == MP_NO) continue;
             mp_prime_is_prime(&a, 3, &res);
-            if (res == 1) break;
+            if (res == MP_YES) break;
          }
 
-         if (res != 1) {
+         if (res != MP_YES) {
             printf("Error not DR modulus\n");
             sizes[x] += 1;
             goto top;
diff --git a/etc/mersenne.c b/etc/mersenne.c
index 7458472..0c9f52f 100644
--- a/etc/mersenne.c
+++ b/etc/mersenne.c
@@ -11,7 +11,7 @@ static mp_err is_mersenne(long s, mp_bool *pp)
    mp_err  res;
    int     k;
 
-   *pp = 0;
+   *pp = MP_NO;
 
    if ((res = mp_init(&n)) != MP_OKAY) {
       return res;
@@ -56,9 +56,9 @@ static mp_err is_mersenne(long s, mp_bool *pp)
    }
 
    /* if u == 0 then its prime */
-   if (mp_iszero(&u) == 1) {
+   if (mp_iszero(&u) == MP_YES) {
       mp_prime_is_prime(&n, 8, pp);
-      if (*pp != 1) printf("FAILURE\n");
+      if (*pp != MP_YES) printf("FAILURE\n");
    }
 
    res = MP_OKAY;
@@ -119,7 +119,7 @@ int main(void)
          return -1;
       }
 
-      if (pp == 1) {
+      if (pp == MP_YES) {
          /* count time */
          tt = clock() - tt;