Commit b3a4341ad7f41ea772257137fd6472ade59c6469

Francois Perrad 2019-05-31T10:53:18

explicit operator precedence

diff --git a/bn_conversion.c b/bn_conversion.c
index 39bdf7a..347f71d 100644
--- a/bn_conversion.c
+++ b/bn_conversion.c
@@ -20,7 +20,7 @@
 #define MP_SET_SIGNED(name, uname, w)                                   \
     void name(mp_int * a, int##w##_t b)                                 \
     {                                                                   \
-        uname(a, b < 0 ? -(uint##w##_t)b : (uint##w##_t)b);             \
+        uname(a, (b < 0) ? -(uint##w##_t)b : (uint##w##_t)b);           \
         if (b < 0) { a->sign = MP_NEG; }                                \
     }
 #define MP_INIT_INT(name , set, type)                     \
@@ -49,7 +49,7 @@
     int##w##_t name(const mp_int* a)                                    \
     {                                                                   \
         uint64_t res = mag(a);                                          \
-        return a->sign == MP_NEG ? (int##w##_t)-res : (int##w##_t)res;  \
+        return (a->sign == MP_NEG) ? (int##w##_t)-res : (int##w##_t)res;\
     }
 
 #ifdef BN_MP_SET_U32_C
diff --git a/bn_deprecated.c b/bn_deprecated.c
index 71fa645..101cdfa 100644
--- a/bn_deprecated.c
+++ b/bn_deprecated.c
@@ -176,7 +176,7 @@ unsigned long mp_get_int(const mp_int *a)
 #ifdef BN_MP_GET_LONG_C
 unsigned long mp_get_long(const mp_int *a)
 {
-   return sizeof(long) > sizeof(int32_t) ? (unsigned long)mp_get_mag64(a) : (unsigned long)mp_get_mag32(a);
+   return (sizeof(long) > sizeof(int32_t)) ? (unsigned long)mp_get_mag64(a) : (unsigned long)mp_get_mag32(a);
 }
 #endif
 #ifdef BN_MP_GET_LONG_LONG_C