commit
c6e9e99efb
@ -44,7 +44,7 @@ mp_err mp_div_d(const mp_int *a, mp_digit b, mp_int *c, mp_digit *d)
|
||||
}
|
||||
|
||||
/* three? */
|
||||
if (MP_HAS(MP_DIV_3) && b == 3u) {
|
||||
if (MP_HAS(MP_DIV_3) && (b == 3u)) {
|
||||
return mp_div_3(a, c, d);
|
||||
}
|
||||
|
||||
|
@ -49,15 +49,15 @@ LBL_ERR:
|
||||
|
||||
/* modified diminished radix reduction */
|
||||
if (MP_HAS(MP_REDUCE_IS_2K_L) && MP_HAS(MP_REDUCE_2K_L) && MP_HAS(S_MP_EXPTMOD) &&
|
||||
mp_reduce_is_2k_l(P) == MP_YES) {
|
||||
(mp_reduce_is_2k_l(P) == MP_YES)) {
|
||||
return s_mp_exptmod(G, X, P, Y, 1);
|
||||
}
|
||||
|
||||
/* is it a DR modulus? default to no */
|
||||
dr = MP_HAS(MP_DR_IS_MODULUS) && mp_dr_is_modulus(P) == MP_YES ? 1 : 0;
|
||||
dr = (MP_HAS(MP_DR_IS_MODULUS) && (mp_dr_is_modulus(P) == MP_YES)) ? 1 : 0;
|
||||
|
||||
/* if not, is it a unrestricted DR modulus? */
|
||||
if (MP_HAS(MP_REDUCE_IS_2K) && dr == 0) {
|
||||
if (MP_HAS(MP_REDUCE_IS_2K) && (dr == 0)) {
|
||||
dr = (mp_reduce_is_2k(P) == MP_YES) ? 2 : 0;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ mp_err mp_mul(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
* was actually slower on the author's machine, but YMMV.
|
||||
*/
|
||||
(min_len >= MP_KARATSUBA_MUL_CUTOFF) &&
|
||||
(max_len / 2 >= MP_KARATSUBA_MUL_CUTOFF) &&
|
||||
((max_len / 2) >= MP_KARATSUBA_MUL_CUTOFF) &&
|
||||
/* Not much effect was observed below a ratio of 1:2, but again: YMMV. */
|
||||
(max_len >= (2 * min_len))) {
|
||||
err = s_mp_balance_mul(a,b,c);
|
||||
|
@ -8,10 +8,10 @@ mp_err mp_sqr(const mp_int *a, mp_int *b)
|
||||
{
|
||||
mp_err err;
|
||||
if (MP_HAS(S_MP_TOOM_SQR) && /* use Toom-Cook? */
|
||||
a->used >= MP_TOOM_SQR_CUTOFF) {
|
||||
(a->used >= MP_TOOM_SQR_CUTOFF)) {
|
||||
err = s_mp_toom_sqr(a, b);
|
||||
} else if (MP_HAS(S_MP_KARATSUBA_SQR) && /* Karatsuba? */
|
||||
a->used >= MP_KARATSUBA_SQR_CUTOFF) {
|
||||
(a->used >= MP_KARATSUBA_SQR_CUTOFF)) {
|
||||
err = s_mp_karatsuba_sqr(a, b);
|
||||
} else if (MP_HAS(S_MP_SQR_FAST) && /* can we use the fast comba multiplier? */
|
||||
(((a->used * 2) + 1) < MP_WARRAY) &&
|
||||
|
Loading…
Reference in New Issue
Block a user