explicit operator precedence

This commit is contained in:
Francois Perrad 2018-12-26 08:33:43 +01:00
parent 8e76691203
commit 5d090112af
4 changed files with 8 additions and 7 deletions

View File

@ -37,7 +37,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) != MP_NO) {
if (a->used == 1 && a->dp[0] == 1u) {
if ((a->used == 1) && (a->dp[0] == 1u)) {
*c = 1;
return e;
} else {

View File

@ -48,7 +48,8 @@ int mp_prime_frobenius_underwood(const mp_int *N, int *result)
for (a = 0; a < LTM_FROBENIUS_UNDERWOOD_A; a++) {
/* TODO: That's ugly! No, really, it is! */
if (a==2||a==4||a==7||a==8||a==10||a==14||a==18||a==23||a==26||a==28) {
if ((a==2) || (a==4) || (a==7) || (a==8) || (a==10) ||
(a==14) || (a==18) || (a==23) || (a==26) || (a==28)) {
continue;
}
/* (32764^2 - 4) < 2^31, no bigint for >MP_8BIT needed) */
@ -83,7 +84,7 @@ int mp_prime_frobenius_underwood(const mp_int *N, int *result)
goto LBL_FU_ERR;
}
/* Composite if N and (a+4)*(2*a+5) are not coprime */
if ((e = mp_set_long(&T1z, (unsigned long)((a+4)*(2*a+5)))) != MP_OKAY) {
if ((e = mp_set_long(&T1z, (unsigned long)((a+4)*((2*a)+5)))) != MP_OKAY) {
goto LBL_FU_ERR;
}
@ -91,7 +92,7 @@ int mp_prime_frobenius_underwood(const mp_int *N, int *result)
goto LBL_FU_ERR;
}
if (!(T1z.used == 1 && T1z.dp[0] == 1u)) {
if (!((T1z.used == 1) && (T1z.dp[0] == 1u))) {
goto LBL_FU_ERR;
}
@ -174,7 +175,7 @@ int mp_prime_frobenius_underwood(const mp_int *N, int *result)
}
}
if ((e = mp_set_long(&T1z, (unsigned long)(2 * a + 5))) != MP_OKAY) {
if ((e = mp_set_long(&T1z, (unsigned long)((2 * a) + 5))) != MP_OKAY) {
goto LBL_FU_ERR;
}
if ((e = mp_mod(&T1z,N,&T1z)) != MP_OKAY) {

View File

@ -41,7 +41,7 @@ int mp_prime_is_prime(const mp_int *a, int t, int *result)
/* Some shortcuts */
/* N > 3 */
if (a->used == 1) {
if (a->dp[0] == 0u || a->dp[0] == 1u) {
if ((a->dp[0] == 0u) || (a->dp[0] == 1u)) {
*result = 0;
return MP_OKAY;
}

View File

@ -133,7 +133,7 @@ int mp_prime_strong_lucas_selfridge(const mp_int *a, int *result)
}
D += 2;
if (D > INT_MAX - 2) {
if (D > (INT_MAX - 2)) {
e = MP_VAL;
goto LBL_LS_ERR;
}