Commit 96ece822c3a852dcedb5508053bd5356128d8b55

Steffen Jaeckel 2019-04-09T21:47:13

Merge pull request #215 from fperrad/20190409_lint some linting

diff --git a/bn_mp_balance_mul.c b/bn_mp_balance_mul.c
index cf83e6f..78c5a82 100644
--- a/bn_mp_balance_mul.c
+++ b/bn_mp_balance_mul.c
@@ -14,7 +14,6 @@ int mp_balance_mul(const mp_int *a, const mp_int *b, mp_int *c)
 
    nblocks = MAX(a->used, b->used) / MIN(a->used, b->used);
    bsize = MIN(a->used, b->used) ;
-   e = MP_OKAY;
 
    if ((e = mp_init_size(&a0, bsize + 2)) != MP_OKAY) {
       return e;
diff --git a/bn_mp_decr.c b/bn_mp_decr.c
index 9dd271a..e605f2c 100644
--- a/bn_mp_decr.c
+++ b/bn_mp_decr.c
@@ -23,11 +23,12 @@ int mp_decr(mp_int *a)
       return MP_OKAY;
    } else if (a->dp[0] > 1uL) {
       a->dp[0]--;
-      if (a->dp[0] == 0) {
+      if (a->dp[0] == 0u) {
          mp_zero(a);
       }
       return MP_OKAY;
+   } else {
+      return mp_sub_d(a, 1uL,a);
    }
-   return mp_sub_d(a, 1uL,a);
 }
 #endif
diff --git a/bn_mp_incr.c b/bn_mp_incr.c
index af1b4c6..052caef 100644
--- a/bn_mp_incr.c
+++ b/bn_mp_incr.c
@@ -23,7 +23,8 @@ int mp_incr(mp_int *a)
    } else if (a->dp[0] < MP_MASK) {
       a->dp[0]++;
       return MP_OKAY;
+   } else {
+      return mp_add_d(a, 1uL,a);
    }
-   return mp_add_d(a, 1uL,a);
 }
 #endif
diff --git a/bn_mp_mul.c b/bn_mp_mul.c
index 585f93c..ff85110 100644
--- a/bn_mp_mul.c
+++ b/bn_mp_mul.c
@@ -27,7 +27,7 @@ int mp_mul(const mp_int *a, const mp_int *b, mp_int *c)
     * was actually slower on the author's machine, but YMMV.
     */
    if ((MIN(len_a, len_b) < KARATSUBA_MUL_CUTOFF)
-       || ((MAX(len_a, len_b)) / 2 < KARATSUBA_MUL_CUTOFF)) {
+       || ((MAX(len_a, len_b) / 2) < KARATSUBA_MUL_CUTOFF)) {
       goto GO_ON;
    }
    /*
diff --git a/tommath_private.h b/tommath_private.h
index aeea591..4d6e587 100644
--- a/tommath_private.h
+++ b/tommath_private.h
@@ -80,7 +80,7 @@ int func_name (mp_int * a, type b)                       \
      while (b != 0u) {                                   \
         a->dp[x++] = ((mp_digit)b & MP_MASK);            \
         if ((CHAR_BIT * sizeof (b)) <= DIGIT_BIT) { break; } \
-        b >>= ((CHAR_BIT * sizeof (b)) <= DIGIT_BIT ? 0 : DIGIT_BIT); \
+        b >>= (((CHAR_BIT * sizeof (b)) <= DIGIT_BIT) ? 0 : DIGIT_BIT); \
      }                                                   \
      a->used = x;                                        \
    }                                                     \