Commit fa2d86af9560c87115c9d5250dd0875ed8f01c0f

Francois Perrad 2019-05-13T03:27:02

explicit operator precedence

diff --git a/bn_mp_dr_reduce.c b/bn_mp_dr_reduce.c
index b82b33d..25b7b15 100644
--- a/bn_mp_dr_reduce.c
+++ b/bn_mp_dr_reduce.c
@@ -58,7 +58,7 @@ top:
    *tmpx1++ = mu;
 
    /* zero words above m */
-   MP_ZERO_DIGITS(tmpx1, x->used - m - 1);
+   MP_ZERO_DIGITS(tmpx1, (x->used - m) - 1);
 
    /* clamp, sub and return */
    mp_clamp(x);
diff --git a/tommath_private.h b/tommath_private.h
index 5ceda2e..678ecbf 100644
--- a/tommath_private.h
+++ b/tommath_private.h
@@ -145,7 +145,7 @@ extern void MP_FREE(void *mem, size_t size);
 extern int (*s_mp_rand_source)(void *out, size_t size);
 
 /* Minimum number of available digits in mp_int, MP_PREC >= MP_MIN_PREC */
-#define MP_MIN_PREC ((CHAR_BIT * (int)sizeof(long long) + MP_DIGIT_BIT - 1) / MP_DIGIT_BIT)
+#define MP_MIN_PREC ((((CHAR_BIT * (int)sizeof(long long)) + MP_DIGIT_BIT) - 1) / MP_DIGIT_BIT)
 
 /* lowlevel functions, do not call! */
 MP_WUR int s_mp_add(const mp_int *a, const mp_int *b, mp_int *c);