Skip to content

Commit 7e47ae6

Browse files
authored
Merge pull request #443 from libtom/rename-maxfast
rename MP_MAXFAST to MP_MAX_COMBA
2 parents b4c4257 + 93f8e76 commit 7e47ae6

File tree

7 files changed

+7
-7
lines changed

7 files changed

+7
-7
lines changed

mp_montgomery_reduce.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ mp_err mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho)
1818
digs = (n->used * 2) + 1;
1919
if ((digs < MP_WARRAY) &&
2020
(x->used <= MP_WARRAY) &&
21-
(n->used < MP_MAXFAST)) {
21+
(n->used < MP_MAX_COMBA)) {
2222
return s_mp_montgomery_reduce_comba(x, n, rho);
2323
}
2424

mp_mul.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ mp_err mp_mul(const mp_int *a, const mp_int *b, mp_int *c)
3939
* digits won't affect carry propagation
4040
*/
4141
(digs < MP_WARRAY) &&
42-
(min <= MP_MAXFAST)) {
42+
(min <= MP_MAX_COMBA)) {
4343
err = s_mp_mul_comba(a, b, c, digs);
4444
} else if (MP_HAS(S_MP_MUL)) {
4545
err = s_mp_mul(a, b, c, digs);

mp_sqr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ mp_err mp_sqr(const mp_int *a, mp_int *b)
1515
err = s_mp_sqr_karatsuba(a, b);
1616
} else if (MP_HAS(S_MP_SQR_COMBA) && /* can we use the fast comba multiplier? */
1717
(((a->used * 2) + 1) < MP_WARRAY) &&
18-
(a->used < (MP_MAXFAST / 2))) {
18+
(a->used < (MP_MAX_COMBA / 2))) {
1919
err = s_mp_sqr_comba(a, b);
2020
} else if (MP_HAS(S_MP_SQR)) {
2121
err = s_mp_sqr(a, b);

s_mp_exptmod_fast.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ mp_err s_mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_i
8282
/* automatically pick the comba one if available (saves quite a few calls/ifs) */
8383
if (MP_HAS(S_MP_MONTGOMERY_REDUCE_COMBA) &&
8484
(((P->used * 2) + 1) < MP_WARRAY) &&
85-
(P->used < MP_MAXFAST)) {
85+
(P->used < MP_MAX_COMBA)) {
8686
redux = s_mp_montgomery_reduce_comba;
8787
} else if (MP_HAS(MP_MONTGOMERY_REDUCE)) {
8888
/* use slower baseline Montgomery method */

s_mp_mul.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ mp_err s_mp_mul(const mp_int *a, const mp_int *b, mp_int *c, int digs)
1515

1616
/* can we use the fast multiplier? */
1717
if ((digs < MP_WARRAY) &&
18-
(MP_MIN(a->used, b->used) < MP_MAXFAST)) {
18+
(MP_MIN(a->used, b->used) < MP_MAX_COMBA)) {
1919
return s_mp_mul_comba(a, b, c, digs);
2020
}
2121

s_mp_mul_high.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ mp_err s_mp_mul_high(const mp_int *a, const mp_int *b, mp_int *c, int digs)
1515
/* can we use the fast multiplier? */
1616
if (MP_HAS(S_MP_MUL_HIGH_COMBA)
1717
&& ((a->used + b->used + 1) < MP_WARRAY)
18-
&& (MP_MIN(a->used, b->used) < MP_MAXFAST)) {
18+
&& (MP_MIN(a->used, b->used) < MP_MAX_COMBA)) {
1919
return s_mp_mul_high_comba(a, b, c, digs);
2020
}
2121

tommath_private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ extern void MP_FREE(void *mem, size_t size);
124124
#define MP_STATIC_ASSERT(msg, cond) typedef char mp_static_assert_##msg[(cond) ? 1 : -1];
125125

126126
#define MP_SIZEOF_BITS(type) ((size_t)CHAR_BIT * sizeof(type))
127-
#define MP_MAXFAST (int)(1uL << (MP_SIZEOF_BITS(mp_word) - (2u * (size_t)MP_DIGIT_BIT)))
128127

128+
#define MP_MAX_COMBA (int)(1uL << (MP_SIZEOF_BITS(mp_word) - (2u * (size_t)MP_DIGIT_BIT)))
129129
#define MP_WARRAY (int)(1uL << ((MP_SIZEOF_BITS(mp_word) - (2u * (size_t)MP_DIGIT_BIT)) + 1u))
130130

131131
#if defined(MP_16BIT)

0 commit comments

Comments
 (0)