rename MP_MAXFAST to MP_MAX_COMBA

This commit is contained in:
Daniel Mendler 2019-11-05 18:04:05 +01:00 committed by Steffen Jaeckel
parent b4c42576d7
commit 93f8e7603d
No known key found for this signature in database
GPG Key ID: AF0CB17621EDAD72
7 changed files with 7 additions and 7 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -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);

View File

@ -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 */

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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)