literal suffix
This commit is contained in:
		
							parent
							
								
									29987bca9a
								
							
						
					
					
						commit
						7a9cb1d1e5
					
				| @ -45,7 +45,7 @@ int mp_get_bit(const mp_int *a, int b) | ||||
|    bit = (mp_digit)(1) << (b % DIGIT_BIT); | ||||
| 
 | ||||
|    isset = a->dp[limb] & bit; | ||||
|    return (isset != 0) ? MP_YES : MP_NO; | ||||
|    return (isset != 0u) ? MP_YES : MP_NO; | ||||
| } | ||||
| 
 | ||||
| #endif | ||||
|  | ||||
| @ -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)) { | ||||
|       if (a->used == 1 && a->dp[0] == 1) { | ||||
|       if (a->used == 1 && a->dp[0] == 1u) { | ||||
|          *c = 1; | ||||
|          return e; | ||||
|       } else { | ||||
| @ -66,7 +66,7 @@ int mp_kronecker(const mp_int *a, const mp_int *p, int *c) | ||||
|    if ((v & 0x1) == 0) { | ||||
|       k = 1; | ||||
|    } else { | ||||
|       k = table[a->dp[0] & 7]; | ||||
|       k = table[a->dp[0] & 7u]; | ||||
|    } | ||||
| 
 | ||||
|    if (p1.sign == MP_NEG) { | ||||
| @ -82,7 +82,7 @@ int mp_kronecker(const mp_int *a, const mp_int *p, int *c) | ||||
| 
 | ||||
|    for (;;) { | ||||
|       if (mp_iszero(&a1)) { | ||||
|          if (mp_cmp_d(&p1, 1) == MP_EQ) { | ||||
|          if (mp_cmp_d(&p1, 1uL) == MP_EQ) { | ||||
|             *c = k; | ||||
|             goto LBL_KRON; | ||||
|          } else { | ||||
| @ -97,7 +97,7 @@ int mp_kronecker(const mp_int *a, const mp_int *p, int *c) | ||||
|       } | ||||
| 
 | ||||
|       if ((v & 0x1) == 1) { | ||||
|          k = k * table[p1.dp[0] & 7]; | ||||
|          k = k * table[p1.dp[0] & 7u]; | ||||
|       } | ||||
| 
 | ||||
|       if (a1.sign == MP_NEG) { | ||||
| @ -106,7 +106,7 @@ 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] + 1) & p1.dp[0] & 2u) { | ||||
|          if ((a1.dp[0] + 1u) & p1.dp[0] & 2u) { | ||||
|             k = -k; | ||||
|          } | ||||
|       } else { | ||||
|  | ||||
| @ -60,7 +60,7 @@ int mp_prime_frobenius_underwood(const mp_int *N, int *result) | ||||
|          goto LBL_FU_ERR; | ||||
|       } | ||||
| 
 | ||||
|       if ((e = mp_sub_d(&T1z,4,&T1z)) != MP_OKAY) { | ||||
|       if ((e = mp_sub_d(&T1z, 4uL, &T1z)) != MP_OKAY) { | ||||
|          goto LBL_FU_ERR; | ||||
|       } | ||||
| 
 | ||||
| @ -96,12 +96,12 @@ int mp_prime_frobenius_underwood(const mp_int *N, int *result) | ||||
|    } | ||||
| 
 | ||||
|    ap2 = a + 2; | ||||
|    if ((e = mp_add_d(N,1u,&Np1z)) != MP_OKAY) { | ||||
|    if ((e = mp_add_d(N, 1uL, &Np1z)) != MP_OKAY) { | ||||
|       goto LBL_FU_ERR; | ||||
|    } | ||||
| 
 | ||||
|    mp_set(&sz,1u); | ||||
|    mp_set(&tz,2u); | ||||
|    mp_set(&sz, 1uL); | ||||
|    mp_set(&tz, 2uL); | ||||
|    length = mp_count_bits(&Np1z); | ||||
| 
 | ||||
|    for (i = length - 2; i >= 0; i--) { | ||||
|  | ||||
| @ -41,11 +41,11 @@ 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] == 0 || a->dp[0] == 1) { | ||||
|       if (a->dp[0] == 0u || a->dp[0] == 1u) { | ||||
|          *result = 0; | ||||
|          return MP_OKAY; | ||||
|       } | ||||
|       if (a->dp[0] == 2) { | ||||
|       if (a->dp[0] == 2u) { | ||||
|          *result = 1; | ||||
|          return MP_OKAY; | ||||
|       } | ||||
| @ -90,7 +90,7 @@ int mp_prime_is_prime(const mp_int *a, int t, int *result) | ||||
|    /*
 | ||||
|        Run the Miller-Rabin test with base 2 for the BPSW test. | ||||
|     */ | ||||
|    if ((err = mp_init_set(&b,2)) != MP_OKAY) { | ||||
|    if ((err = mp_init_set(&b, 2uL)) != MP_OKAY) { | ||||
|       return err; | ||||
|    } | ||||
| 
 | ||||
| @ -339,7 +339,7 @@ int mp_prime_is_prime(const mp_int *a, int t, int *result) | ||||
|          } | ||||
| 
 | ||||
|          /* Although the chance for b <= 3 is miniscule, try again. */ | ||||
|          if (mp_cmp_d(&b,3) != MP_GT) { | ||||
|          if (mp_cmp_d(&b, 3uL) != MP_GT) { | ||||
|             ix--; | ||||
|             continue; | ||||
|          } | ||||
|  | ||||
| @ -118,7 +118,7 @@ int mp_prime_strong_lucas_selfridge(const mp_int *a, int *result) | ||||
|       /* if 1 < GCD < N then N is composite with factor "D", and
 | ||||
|          Jacobi(D,N) is technically undefined (but often returned | ||||
|          as zero). */ | ||||
|       if ((mp_cmp_d(&gcd,1u) == MP_GT) && (mp_cmp(&gcd,a) == MP_LT)) { | ||||
|       if ((mp_cmp_d(&gcd, 1uL) == MP_GT) && (mp_cmp(&gcd, a) == MP_LT)) { | ||||
|          goto LBL_LS_ERR; | ||||
|       } | ||||
|       if (Ds < 0) { | ||||
| @ -172,7 +172,7 @@ int mp_prime_strong_lucas_selfridge(const mp_int *a, int *result) | ||||
|       Baillie-PSW test based on the strong Lucas-Selfridge test | ||||
|       should be more reliable. */ | ||||
| 
 | ||||
|    if ((e = mp_add_d(a,1u,&Np1)) != MP_OKAY) { | ||||
|    if ((e = mp_add_d(a, 1uL, &Np1)) != MP_OKAY) { | ||||
|       goto LBL_LS_ERR; | ||||
|    } | ||||
|    s = mp_cnt_lsb(&Np1); | ||||
| @ -198,9 +198,9 @@ int mp_prime_strong_lucas_selfridge(const mp_int *a, int *result) | ||||
|       combined with the previous totals for U and V, using the | ||||
|       composition formulas for addition of indices. */ | ||||
| 
 | ||||
|    mp_set(&Uz, 1u);    /* U=U_1 */ | ||||
|    mp_set(&Uz, 1uL);    /* U=U_1 */ | ||||
|    mp_set(&Vz, (mp_digit)P);    /* V=V_1 */ | ||||
|    mp_set(&U2mz, 1u);  /* U_1 */ | ||||
|    mp_set(&U2mz, 1uL);  /* U_1 */ | ||||
|    mp_set(&V2mz, (mp_digit)P);  /* V_1 */ | ||||
| 
 | ||||
|    if (Q < 0) { | ||||
| @ -314,7 +314,7 @@ int mp_prime_strong_lucas_selfridge(const mp_int *a, int *result) | ||||
|             goto LBL_LS_ERR; | ||||
|          } | ||||
|          if ((Uz.sign == MP_NEG) && mp_isodd(&Uz)) { | ||||
|             if ((e = mp_sub_d(&Uz,1u,&Uz)) != MP_OKAY) { | ||||
|             if ((e = mp_sub_d(&Uz, 1uL, &Uz)) != MP_OKAY) { | ||||
|                goto LBL_LS_ERR; | ||||
|             } | ||||
|          } | ||||
| @ -330,7 +330,7 @@ int mp_prime_strong_lucas_selfridge(const mp_int *a, int *result) | ||||
|             goto LBL_LS_ERR; | ||||
|          } | ||||
|          if (Vz.sign == MP_NEG && mp_isodd(&Vz)) { | ||||
|             if ((e = mp_sub_d(&Vz,1,&Vz)) != MP_OKAY) { | ||||
|             if ((e = mp_sub_d(&Vz, 1uL, &Vz)) != MP_OKAY) { | ||||
|                goto LBL_LS_ERR; | ||||
|             } | ||||
|          } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user