explicit operator precedence
This commit is contained in:
		
							parent
							
								
									8e76691203
								
							
						
					
					
						commit
						5d090112af
					
				| @ -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}; |    static const int table[8] = {0, 1, 0, -1, 0, -1, 0, 1}; | ||||||
| 
 | 
 | ||||||
|    if (mp_iszero(p) != MP_NO) { |    if (mp_iszero(p) != MP_NO) { | ||||||
|       if (a->used == 1 && a->dp[0] == 1u) { |       if ((a->used == 1) && (a->dp[0] == 1u)) { | ||||||
|          *c = 1; |          *c = 1; | ||||||
|          return e; |          return e; | ||||||
|       } else { |       } else { | ||||||
|  | |||||||
| @ -48,7 +48,8 @@ int mp_prime_frobenius_underwood(const mp_int *N, int *result) | |||||||
| 
 | 
 | ||||||
|    for (a = 0; a < LTM_FROBENIUS_UNDERWOOD_A; a++) { |    for (a = 0; a < LTM_FROBENIUS_UNDERWOOD_A; a++) { | ||||||
|       /* TODO: That's ugly! No, really, it is! */ |       /* 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; |          continue; | ||||||
|       } |       } | ||||||
|       /* (32764^2 - 4) < 2^31, no bigint for >MP_8BIT needed) */ |       /* (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; |       goto LBL_FU_ERR; | ||||||
|    } |    } | ||||||
|    /* Composite if N and (a+4)*(2*a+5) are not coprime */ |    /* 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; |       goto LBL_FU_ERR; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
| @ -91,7 +92,7 @@ int mp_prime_frobenius_underwood(const mp_int *N, int *result) | |||||||
|       goto LBL_FU_ERR; |       goto LBL_FU_ERR; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    if (!(T1z.used == 1 && T1z.dp[0] == 1u)) { |    if (!((T1z.used == 1) && (T1z.dp[0] == 1u))) { | ||||||
|       goto LBL_FU_ERR; |       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; |       goto LBL_FU_ERR; | ||||||
|    } |    } | ||||||
|    if ((e = mp_mod(&T1z,N,&T1z)) != MP_OKAY) { |    if ((e = mp_mod(&T1z,N,&T1z)) != MP_OKAY) { | ||||||
|  | |||||||
| @ -41,7 +41,7 @@ int mp_prime_is_prime(const mp_int *a, int t, int *result) | |||||||
|    /* Some shortcuts */ |    /* Some shortcuts */ | ||||||
|    /* N > 3 */ |    /* N > 3 */ | ||||||
|    if (a->used == 1) { |    if (a->used == 1) { | ||||||
|       if (a->dp[0] == 0u || a->dp[0] == 1u) { |       if ((a->dp[0] == 0u) || (a->dp[0] == 1u)) { | ||||||
|          *result = 0; |          *result = 0; | ||||||
|          return MP_OKAY; |          return MP_OKAY; | ||||||
|       } |       } | ||||||
|  | |||||||
| @ -133,7 +133,7 @@ int mp_prime_strong_lucas_selfridge(const mp_int *a, int *result) | |||||||
|       } |       } | ||||||
|       D += 2; |       D += 2; | ||||||
| 
 | 
 | ||||||
|       if (D > INT_MAX - 2) { |       if (D > (INT_MAX - 2)) { | ||||||
|          e = MP_VAL; |          e = MP_VAL; | ||||||
|          goto LBL_LS_ERR; |          goto LBL_LS_ERR; | ||||||
|       } |       } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user