Merge pull request #376 from fperrad/20191015_lint

some linting
This commit is contained in:
Steffen Jaeckel 2019-10-15 19:20:34 +02:00 committed by GitHub
commit 69a7ca78aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 4 deletions

View File

@ -92,9 +92,9 @@ mp_err mp_log_u32(const mp_int *a, uint32_t base, uint32_t *c)
}
/* A small shortcut for bases that are powers of two. */
if (!(base & (base - 1u))) {
if ((base & (base - 1u)) == 0u) {
int y, bit_count;
for (y=0; (y < 7) && !(base & 1u); y++) {
for (y=0; (y < 7) && ((base & 1u) == 0u); y++) {
base >>= 1;
}
bit_count = mp_count_bits(a) - 1;
@ -108,7 +108,7 @@ mp_err mp_log_u32(const mp_int *a, uint32_t base, uint32_t *c)
}
cmp = mp_cmp_d(a, base);
if (cmp == MP_LT || cmp == MP_EQ) {
if ((cmp == MP_LT) || (cmp == MP_EQ)) {
*c = cmp == MP_EQ;
return err;
}
@ -167,7 +167,7 @@ mp_err mp_log_u32(const mp_int *a, uint32_t base, uint32_t *c)
}
}
*c = mp_cmp(&bracket_high, a) == MP_EQ ? high : low;
*c = (mp_cmp(&bracket_high, a) == MP_EQ) ? high : low;
LBL_END:
LBL_ERR:

View File

@ -1,5 +1,6 @@
/* tests the montgomery routines */
#include <tommath.h>
#include <stdlib.h>
#include <time.h>
int main(void)

View File

@ -4,6 +4,7 @@
*
* Tom St Denis, tomstdenis@gmail.com, http://tom.gmail.com
*/
#include <stdlib.h>
#include <time.h>
#include "tommath.h"