explicit condition

This commit is contained in:
Francois Perrad 2018-12-26 08:24:49 +01:00
parent 7a9cb1d1e5
commit 8e76691203
4 changed files with 13 additions and 13 deletions

@ -34,7 +34,7 @@ int mp_get_bit(const mp_int *a, int b)
* otherwise (limb >= a->used) would be true for a = 0
*/
if (mp_iszero(a)) {
if (mp_iszero(a) != MP_NO) {
return MP_NO;
}

@ -36,7 +36,7 @@ int mp_kronecker(const mp_int *a, const mp_int *p, int *c)
static const int table[8] = {0, 1, 0, -1, 0, -1, 0, 1};
if (mp_iszero(p)) {
if (mp_iszero(p) != MP_NO) {
if (a->used == 1 && a->dp[0] == 1u) {
*c = 1;
return e;
@ -46,7 +46,7 @@ int mp_kronecker(const mp_int *a, const mp_int *p, int *c)
}
}
if (mp_iseven(a) && mp_iseven(p)) {
if ((mp_iseven(a) != MP_NO) && (mp_iseven(p) != MP_NO)) {
*c = 0;
return e;
}
@ -81,7 +81,7 @@ int mp_kronecker(const mp_int *a, const mp_int *p, int *c)
}
for (;;) {
if (mp_iszero(&a1)) {
if (mp_iszero(&a1) != MP_NO) {
if (mp_cmp_d(&p1, 1uL) == MP_EQ) {
*c = k;
goto LBL_KRON;
@ -106,12 +106,12 @@ int mp_kronecker(const mp_int *a, const mp_int *p, int *c)
* a1.dp[0] + 1 cannot overflow because the MSB
* of the type mp_digit is not set by definition
*/
if ((a1.dp[0] + 1u) & p1.dp[0] & 2u) {
if (((a1.dp[0] + 1u) & p1.dp[0] & 2u) != 0u) {
k = -k;
}
} else {
/* compute k = (-1)^((a1-1)*(p1-1)/4) * k */
if (a1.dp[0] & p1.dp[0] & 2u) {
if ((a1.dp[0] & p1.dp[0] & 2u) != 0u) {
k = -k;
}
}

@ -180,7 +180,7 @@ int mp_prime_frobenius_underwood(const mp_int *N, int *result)
if ((e = mp_mod(&T1z,N,&T1z)) != MP_OKAY) {
goto LBL_FU_ERR;
}
if (mp_iszero(&sz) && (mp_cmp(&tz, &T1z) == MP_EQ)) {
if ((mp_iszero(&sz) != MP_NO) && (mp_cmp(&tz, &T1z) == MP_EQ)) {
*result = MP_YES;
goto LBL_FU_ERR;
}

@ -300,7 +300,7 @@ int mp_prime_strong_lucas_selfridge(const mp_int *a, int *result)
if ((e = mp_add(&T1z,&T2z,&Uz)) != MP_OKAY) {
goto LBL_LS_ERR;
}
if (mp_isodd(&Uz)) {
if (mp_isodd(&Uz) != MP_NO) {
if ((e = mp_add(&Uz,a,&Uz)) != MP_OKAY) {
goto LBL_LS_ERR;
}
@ -313,7 +313,7 @@ int mp_prime_strong_lucas_selfridge(const mp_int *a, int *result)
if ((e = mp_div_2(&Uz,&Uz)) != MP_OKAY) {
goto LBL_LS_ERR;
}
if ((Uz.sign == MP_NEG) && mp_isodd(&Uz)) {
if ((Uz.sign == MP_NEG) && (mp_isodd(&Uz) != MP_NO)) {
if ((e = mp_sub_d(&Uz, 1uL, &Uz)) != MP_OKAY) {
goto LBL_LS_ERR;
}
@ -321,7 +321,7 @@ int mp_prime_strong_lucas_selfridge(const mp_int *a, int *result)
if ((e = mp_add(&T3z,&T4z,&Vz)) != MP_OKAY) {
goto LBL_LS_ERR;
}
if (mp_isodd(&Vz)) {
if (mp_isodd(&Vz) != MP_NO) {
if ((e = mp_add(&Vz,a,&Vz)) != MP_OKAY) {
goto LBL_LS_ERR;
}
@ -329,7 +329,7 @@ int mp_prime_strong_lucas_selfridge(const mp_int *a, int *result)
if ((e = mp_div_2(&Vz,&Vz)) != MP_OKAY) {
goto LBL_LS_ERR;
}
if (Vz.sign == MP_NEG && mp_isodd(&Vz)) {
if ((Vz.sign == MP_NEG) && (mp_isodd(&Vz) != MP_NO)) {
if ((e = mp_sub_d(&Vz, 1uL, &Vz)) != MP_OKAY) {
goto LBL_LS_ERR;
}
@ -352,7 +352,7 @@ int mp_prime_strong_lucas_selfridge(const mp_int *a, int *result)
/* If U_d or V_d is congruent to 0 mod N, then N is a prime or a
strong Lucas pseudoprime. */
if (mp_iszero(&Uz) || mp_iszero(&Vz)) {
if ((mp_iszero(&Uz) != MP_NO) || (mp_iszero(&Vz) != MP_NO)) {
*result = MP_YES;
goto LBL_LS_ERR;
}
@ -383,7 +383,7 @@ int mp_prime_strong_lucas_selfridge(const mp_int *a, int *result)
if ((e = mp_mod(&Vz,a,&Vz)) != MP_OKAY) {
goto LBL_LS_ERR;
}
if (mp_iszero(&Vz)) {
if (mp_iszero(&Vz) != MP_NO) {
*result = MP_YES;
goto LBL_LS_ERR;
}