Skip to content

Commit 2b41c95

Browse files
authored
Merge pull request #292 from fperrad/20190523_lint
some linting
2 parents 431ea33 + 25ff85d commit 2b41c95

12 files changed

+16
-16
lines changed

bn_mp_ilogb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static mp_digit s_digit_ilogb(mp_digit base, mp_digit n)
4242

4343
while (((mp_digit)(high - low)) > 1uL) {
4444
mid = (low + high) >> 1;
45-
bracket_mid = bracket_low * s_pow(base, mid - low) ;
45+
bracket_mid = bracket_low * s_pow(base, (mp_word)(mid - low));
4646

4747
if (N < bracket_mid) {
4848
high = mid ;

bn_mp_montgomery_reduce.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ mp_err mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho)
1717
* are fixed up in the inner loop.
1818
*/
1919
digs = (n->used * 2) + 1;
20-
if ((digs < (int)MP_WARRAY) &&
21-
(x->used <= (int)MP_WARRAY) &&
20+
if ((digs < MP_WARRAY) &&
21+
(x->used <= MP_WARRAY) &&
2222
(n->used < MP_MAXFAST)) {
2323
return s_mp_montgomery_reduce_fast(x, n, rho);
2424
}

bn_mp_mul.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ mp_err mp_mul(const mp_int *a, const mp_int *b, mp_int *c)
6666
int digs = a->used + b->used + 1;
6767

6868
#ifdef BN_S_MP_MUL_DIGS_FAST_C
69-
if ((digs < (int)MP_WARRAY) &&
69+
if ((digs < MP_WARRAY) &&
7070
(MP_MIN(a->used, b->used) <= MP_MAXFAST)) {
7171
err = s_mp_mul_digs_fast(a, b, c, digs);
7272
} else

bn_mp_prime_rand.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ mp_err s_mp_prime_random_ex(mp_int *a, int t, int size, int flags, private_mp_pr
4545
}
4646

4747
/* calc the maskAND value for the MSbyte*/
48-
maskAND = ((size&7) == 0) ? 0xFF : (unsigned char)(0xFF >> (8 - (size & 7)));
48+
maskAND = ((size&7) == 0) ? 0xFFu : (unsigned char)(0xFFu >> (8 - (size & 7)));
4949

5050
/* calc the maskOR_msb */
5151
maskOR_msb = 0;
@@ -55,9 +55,9 @@ mp_err s_mp_prime_random_ex(mp_int *a, int t, int size, int flags, private_mp_pr
5555
}
5656

5757
/* get the maskOR_lsb */
58-
maskOR_lsb = 1;
58+
maskOR_lsb = 1u;
5959
if ((flags & MP_PRIME_BBS) != 0) {
60-
maskOR_lsb |= 3;
60+
maskOR_lsb |= 3u;
6161
}
6262

6363
do {

bn_mp_rand.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ mp_err mp_rand(mp_int *a, int digits)
3030
}
3131

3232
/* TODO: We ensure that the highest digit is nonzero. Should this be removed? */
33-
while ((a->dp[digits - 1] & MP_MASK) == 0) {
33+
while ((a->dp[digits - 1] & MP_MASK) == 0u) {
3434
if ((err = s_mp_rand_source(a->dp + digits - 1, sizeof(mp_digit))) != MP_OKAY) {
3535
return err;
3636
}

bn_mp_sqr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ mp_err mp_sqr(const mp_int *a, mp_int *b)
2323
{
2424
#ifdef BN_S_MP_SQR_FAST_C
2525
/* can we use the fast comba multiplier? */
26-
if ((((a->used * 2) + 1) < (int)MP_WARRAY) &&
26+
if ((((a->used * 2) + 1) < MP_WARRAY) &&
2727
(a->used < (MP_MAXFAST / 2))) {
2828
err = s_mp_sqr_fast(a, b);
2929
} else

bn_s_mp_exptmod.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ mp_err s_mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y
146146
}
147147

148148
/* grab the next msb from the exponent */
149-
y = (buf >> (mp_digit)(MP_DIGIT_BIT - 1)) & 1;
149+
y = (buf >> (mp_digit)(MP_DIGIT_BIT - 1)) & 1uL;
150150
buf <<= (mp_digit)1;
151151

152152
/* if the bit is zero and mode == 0 then we ignore it

bn_s_mp_exptmod_fast.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ mp_err s_mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_i
8585

8686
/* automatically pick the comba one if available (saves quite a few calls/ifs) */
8787
#ifdef BN_S_MP_MONTGOMERY_REDUCE_FAST_C
88-
if ((((P->used * 2) + 1) < (int)MP_WARRAY) &&
88+
if ((((P->used * 2) + 1) < MP_WARRAY) &&
8989
(P->used < MP_MAXFAST)) {
9090
redux = s_mp_montgomery_reduce_fast;
9191
} else
@@ -200,7 +200,7 @@ mp_err s_mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_i
200200
}
201201

202202
/* grab the next msb from the exponent */
203-
y = (mp_digit)(buf >> (MP_DIGIT_BIT - 1)) & 1;
203+
y = (mp_digit)(buf >> (MP_DIGIT_BIT - 1)) & 1uL;
204204
buf <<= (mp_digit)1;
205205

206206
/* if the bit is zero and mode == 0 then we ignore it

bn_s_mp_montgomery_reduce_fast.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mp_err s_mp_montgomery_reduce_fast(mp_int *x, const mp_int *n, mp_digit rho)
1717
mp_err err;
1818
mp_word W[MP_WARRAY];
1919

20-
if (x->used > (int)MP_WARRAY) {
20+
if (x->used > MP_WARRAY) {
2121
return MP_VAL;
2222
}
2323

bn_s_mp_mul_digs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mp_err s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs)
1717
mp_digit tmpx, *tmpt, *tmpy;
1818

1919
/* can we use the fast multiplier? */
20-
if ((digs < (int)MP_WARRAY) &&
20+
if ((digs < MP_WARRAY) &&
2121
(MP_MIN(a->used, b->used) < MP_MAXFAST)) {
2222
return s_mp_mul_digs_fast(a, b, c, digs);
2323
}

0 commit comments

Comments
 (0)