Merge pull request #215 from fperrad/20190409_lint some linting
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
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; \
} \