literal suffix
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
diff --git a/bn_mp_get_bit.c b/bn_mp_get_bit.c
index b124325..8cd06a5 100644
--- a/bn_mp_get_bit.c
+++ b/bn_mp_get_bit.c
@@ -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
diff --git a/bn_mp_kronecker.c b/bn_mp_kronecker.c
index 477ef00..ff9d2b6 100644
--- a/bn_mp_kronecker.c
+++ b/bn_mp_kronecker.c
@@ -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 {
diff --git a/bn_mp_prime_frobenius_underwood.c b/bn_mp_prime_frobenius_underwood.c
index 2950b0b..4f44c5e 100644
--- a/bn_mp_prime_frobenius_underwood.c
+++ b/bn_mp_prime_frobenius_underwood.c
@@ -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--) {
diff --git a/bn_mp_prime_is_prime.c b/bn_mp_prime_is_prime.c
index 43d9924..5bde2c8 100644
--- a/bn_mp_prime_is_prime.c
+++ b/bn_mp_prime_is_prime.c
@@ -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;
}
diff --git a/bn_mp_prime_strong_lucas_selfridge.c b/bn_mp_prime_strong_lucas_selfridge.c
index 38972ff..9a50cdc 100644
--- a/bn_mp_prime_strong_lucas_selfridge.c
+++ b/bn_mp_prime_strong_lucas_selfridge.c
@@ -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;
}
}