Commit 6d63370370ae03961a933bfa4daf5b995755f4bb

Francois Perrad 2019-03-26T18:51:35

explicit operator precedence

diff --git a/bn_mp_read_radix.c b/bn_mp_read_radix.c
index 5c3a5c6..abfc4a1 100644
--- a/bn_mp_read_radix.c
+++ b/bn_mp_read_radix.c
@@ -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)
diff --git a/tommath_private.h b/tommath_private.h
index 7d62c1e..c426667 100644
--- a/tommath_private.h
+++ b/tommath_private.h
@@ -90,7 +90,8 @@ 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) {                                         \