Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bn_mp_read_radix.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* SPDX-License-Identifier: Unlicense
*/

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

/* read a string [ASCII] in a given radix */
int mp_read_radix(mp_int *a, const char *str, int radix)
Expand Down
5 changes: 3 additions & 2 deletions tommath_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,11 @@ extern const size_t mp_s_rmap_reverse_sz;
int func_name (mp_int * a, type b) \
{ \
int x = 0; \
int res = mp_grow(a, (CHAR_BIT * sizeof(type) + DIGIT_BIT - 1) / DIGIT_BIT); \
int new_size = (((CHAR_BIT * sizeof(type)) + DIGIT_BIT) - 1) / DIGIT_BIT; \
int res = mp_grow(a, new_size); \
if (res == MP_OKAY) { \
mp_zero(a); \
while (b) { \
while (b != 0u) { \
a->dp[x++] = ((mp_digit)b & MP_MASK); \
b >>= DIGIT_BIT; \
} \
Expand Down