Commit ad402d43517856f8cc965d3f5a21347c8adbbe60

Steffen Jaeckel 2019-09-03T00:28:02

no need for that if-else

diff --git a/bn_mp_prime_next_prime.c b/bn_mp_prime_next_prime.c
index 81b781b..17abbf8 100644
--- a/bn_mp_prime_next_prime.c
+++ b/bn_mp_prime_next_prime.c
@@ -24,24 +24,18 @@ mp_err mp_prime_next_prime(mp_int *a, int t, int bbs_style)
       /* find which prime it is bigger than */
       for (x = PRIVATE_MP_PRIME_TAB_SIZE - 2; x >= 0; x--) {
          if (mp_cmp_d(a, s_mp_prime_tab[x]) != MP_LT) {
+            /* ok we found a prime smaller or
+             * equal [so the next is larger]
+             */
             if (bbs_style == 1) {
-               /* ok we found a prime smaller or
-                * equal [so the next is larger]
-                *
-                * however, the prime must be
+               /* ... however, the prime must be
                 * congruent to 3 mod 4
-                */
-               if ((s_mp_prime_tab[x + 1] & 3u) != 3u) {
-                  /* scan upwards for a prime congruent to 3 mod 4 */
-                  for (y = x + 1; y < PRIVATE_MP_PRIME_TAB_SIZE; y++) {
-                     if ((s_mp_prime_tab[y] & 3u) == 3u) {
-                        mp_set(a, s_mp_prime_tab[y]);
-                        return MP_OKAY;
-                     }
+                * so do a scan upwards for such a prime */
+               for (y = x + 1; y < PRIVATE_MP_PRIME_TAB_SIZE; y++) {
+                  if ((s_mp_prime_tab[y] & 3u) == 3u) {
+                     mp_set(a, s_mp_prime_tab[y]);
+                     return MP_OKAY;
                   }
-               } else {
-                  mp_set(a, s_mp_prime_tab[x + 1]);
-                  return MP_OKAY;
                }
             } else {
                mp_set(a, s_mp_prime_tab[x + 1]);