Skip to content

Commit 0539903

Browse files
authored
Merge pull request #186 from fperrad/20190326_lint
some linting
2 parents 3841062 + 9d63882 commit 0539903

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

bn_mp_read_radix.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* SPDX-License-Identifier: Unlicense
1313
*/
1414

15-
#define MP_TOUPPER(c) ((c) >= 'a' && (c) <= 'z' ? (c) + 'A' - 'a' : (c))
15+
#define MP_TOUPPER(c) ((((c) >= 'a') && ((c) <= 'z')) ? (((c) + 'A') - 'a') : (c))
1616

1717
/* read a string [ASCII] in a given radix */
1818
int mp_read_radix(mp_int *a, const char *str, int radix)

tommath_private.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,11 @@ extern const size_t mp_s_rmap_reverse_sz;
9090
int func_name (mp_int * a, type b) \
9191
{ \
9292
int x = 0; \
93-
int res = mp_grow(a, (CHAR_BIT * sizeof(type) + DIGIT_BIT - 1) / DIGIT_BIT); \
93+
int new_size = (((CHAR_BIT * sizeof(type)) + DIGIT_BIT) - 1) / DIGIT_BIT; \
94+
int res = mp_grow(a, new_size); \
9495
if (res == MP_OKAY) { \
9596
mp_zero(a); \
96-
while (b) { \
97+
while (b != 0u) { \
9798
a->dp[x++] = ((mp_digit)b & MP_MASK); \
9899
b >>= DIGIT_BIT; \
99100
} \

0 commit comments

Comments
 (0)