Commit 93f8e7603d727a88519d01418561bc4439b489ae

Daniel Mendler 2019-11-05T18:04:05

rename MP_MAXFAST to MP_MAX_COMBA

diff --git a/mp_montgomery_reduce.c b/mp_montgomery_reduce.c
index de6a900..dbf45d3 100644
--- a/mp_montgomery_reduce.c
+++ b/mp_montgomery_reduce.c
@@ -18,7 +18,7 @@ mp_err mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho)
    digs = (n->used * 2) + 1;
    if ((digs < MP_WARRAY) &&
        (x->used <= MP_WARRAY) &&
-       (n->used < MP_MAXFAST)) {
+       (n->used < MP_MAX_COMBA)) {
       return s_mp_montgomery_reduce_comba(x, n, rho);
    }
 
diff --git a/mp_mul.c b/mp_mul.c
index 4103535..9a83687 100644
--- a/mp_mul.c
+++ b/mp_mul.c
@@ -39,7 +39,7 @@ mp_err mp_mul(const mp_int *a, const mp_int *b, mp_int *c)
                * digits won't affect carry propagation
                */
               (digs < MP_WARRAY) &&
-              (min <= MP_MAXFAST)) {
+              (min <= MP_MAX_COMBA)) {
       err = s_mp_mul_comba(a, b, c, digs);
    } else if (MP_HAS(S_MP_MUL)) {
       err = s_mp_mul(a, b, c, digs);
diff --git a/mp_sqr.c b/mp_sqr.c
index b0da0ed..67a8224 100644
--- a/mp_sqr.c
+++ b/mp_sqr.c
@@ -15,7 +15,7 @@ mp_err mp_sqr(const mp_int *a, mp_int *b)
       err = s_mp_sqr_karatsuba(a, b);
    } else if (MP_HAS(S_MP_SQR_COMBA) && /* can we use the fast comba multiplier? */
               (((a->used * 2) + 1) < MP_WARRAY) &&
-              (a->used < (MP_MAXFAST / 2))) {
+              (a->used < (MP_MAX_COMBA / 2))) {
       err = s_mp_sqr_comba(a, b);
    } else if (MP_HAS(S_MP_SQR)) {
       err = s_mp_sqr(a, b);
diff --git a/s_mp_exptmod_fast.c b/s_mp_exptmod_fast.c
index 813eef2..e7729f4 100644
--- a/s_mp_exptmod_fast.c
+++ b/s_mp_exptmod_fast.c
@@ -82,7 +82,7 @@ mp_err s_mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_i
       /* automatically pick the comba one if available (saves quite a few calls/ifs) */
       if (MP_HAS(S_MP_MONTGOMERY_REDUCE_COMBA) &&
           (((P->used * 2) + 1) < MP_WARRAY) &&
-          (P->used < MP_MAXFAST)) {
+          (P->used < MP_MAX_COMBA)) {
          redux = s_mp_montgomery_reduce_comba;
       } else if (MP_HAS(MP_MONTGOMERY_REDUCE)) {
          /* use slower baseline Montgomery method */
diff --git a/s_mp_mul.c b/s_mp_mul.c
index cd17b99..fb99d80 100644
--- a/s_mp_mul.c
+++ b/s_mp_mul.c
@@ -15,7 +15,7 @@ mp_err s_mp_mul(const mp_int *a, const mp_int *b, mp_int *c, int digs)
 
    /* can we use the fast multiplier? */
    if ((digs < MP_WARRAY) &&
-       (MP_MIN(a->used, b->used) < MP_MAXFAST)) {
+       (MP_MIN(a->used, b->used) < MP_MAX_COMBA)) {
       return s_mp_mul_comba(a, b, c, digs);
    }
 
diff --git a/s_mp_mul_high.c b/s_mp_mul_high.c
index d1d1806..1bde00a 100644
--- a/s_mp_mul_high.c
+++ b/s_mp_mul_high.c
@@ -15,7 +15,7 @@ mp_err s_mp_mul_high(const mp_int *a, const mp_int *b, mp_int *c, int digs)
    /* can we use the fast multiplier? */
    if (MP_HAS(S_MP_MUL_HIGH_COMBA)
        && ((a->used + b->used + 1) < MP_WARRAY)
-       && (MP_MIN(a->used, b->used) < MP_MAXFAST)) {
+       && (MP_MIN(a->used, b->used) < MP_MAX_COMBA)) {
       return s_mp_mul_high_comba(a, b, c, digs);
    }
 
diff --git a/tommath_private.h b/tommath_private.h
index 0969796..9a3e2f8 100644
--- a/tommath_private.h
+++ b/tommath_private.h
@@ -124,8 +124,8 @@ extern void MP_FREE(void *mem, size_t size);
 #define MP_STATIC_ASSERT(msg, cond) typedef char mp_static_assert_##msg[(cond) ? 1 : -1];
 
 #define MP_SIZEOF_BITS(type)    ((size_t)CHAR_BIT * sizeof(type))
-#define MP_MAXFAST              (int)(1uL << (MP_SIZEOF_BITS(mp_word) - (2u * (size_t)MP_DIGIT_BIT)))
 
+#define MP_MAX_COMBA            (int)(1uL << (MP_SIZEOF_BITS(mp_word) - (2u * (size_t)MP_DIGIT_BIT)))
 #define MP_WARRAY               (int)(1uL << ((MP_SIZEOF_BITS(mp_word) - (2u * (size_t)MP_DIGIT_BIT)) + 1u))
 
 #if defined(MP_16BIT)