Commit 3e15a3ff461b979ae965c71bfc793d4ac60d4532

Francois Perrad 2019-05-26T08:33:49

literal suffix

diff --git a/bn_conversion.c b/bn_conversion.c
index 347f71d..19e5532 100644
--- a/bn_conversion.c
+++ b/bn_conversion.c
@@ -37,8 +37,8 @@
     uint##w##_t name(const mp_int* a)                                   \
     {                                                                   \
         unsigned i = MP_MIN((unsigned)a->used, (unsigned)((w + MP_DIGIT_BIT - 1) / MP_DIGIT_BIT)); \
-        uint##w##_t res = 0;                                            \
-        while (i --> 0) {                                               \
+        uint##w##_t res = 0u;                                           \
+        while (i --> 0u) {                                              \
             res <<= ((w <= MP_DIGIT_BIT) ? 0 : MP_DIGIT_BIT);           \
             res |= (uint##w##_t)a->dp[i];                               \
             if (w <= MP_DIGIT_BIT) { break; }                           \
diff --git a/bn_mp_ilogb.c b/bn_mp_ilogb.c
index ff237dd..b584c43 100644
--- a/bn_mp_ilogb.c
+++ b/bn_mp_ilogb.c
@@ -104,7 +104,7 @@ mp_err mp_ilogb(const mp_int *a, mp_digit base, mp_int *c)
       return err;
    }
    if (cmp == MP_EQ) {
-      mp_set(c, 1u);
+      mp_set(c, 1uL);
       return err;
    }
 
diff --git a/bn_mp_is_square.c b/bn_mp_is_square.c
index 5c191dc..69e77a2 100644
--- a/bn_mp_is_square.c
+++ b/bn_mp_is_square.c
@@ -58,7 +58,7 @@ mp_err mp_is_square(const mp_int *arg, mp_bool *ret)
    }
 
 
-   if ((err = mp_init_u32(&t, 11L*13L*17L*19L*23L*29L*31L)) != MP_OKAY) {
+   if ((err = mp_init_u32(&t, 11u*13u*17u*19u*23u*29u*31u)) != MP_OKAY) {
       return err;
    }
    if ((err = mp_mod(arg, &t, &t)) != MP_OKAY) {
diff --git a/bn_mp_prime_strong_lucas_selfridge.c b/bn_mp_prime_strong_lucas_selfridge.c
index e58b64a..34b073c 100644
--- a/bn_mp_prime_strong_lucas_selfridge.c
+++ b/bn_mp_prime_strong_lucas_selfridge.c
@@ -172,9 +172,9 @@ mp_err mp_prime_strong_lucas_selfridge(const mp_int *a, mp_bool *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) {
diff --git a/bn_mp_sqrtmod_prime.c b/bn_mp_sqrtmod_prime.c
index 0ce83bd..f803760 100644
--- a/bn_mp_sqrtmod_prime.c
+++ b/bn_mp_sqrtmod_prime.c
@@ -59,7 +59,7 @@ mp_err mp_sqrtmod_prime(const mp_int *n, const mp_int *prime, mp_int *ret)
    }
 
    /* find a Z such that the Legendre symbol (Z|prime) == -1 */
-   mp_set_u32(&Z, 2uL);
+   mp_set_u32(&Z, 2u);
    /* Z = 2 */
    while (1) {
       if ((err = mp_kronecker(&Z, prime, &legendre)) != MP_OKAY)     goto cleanup;
@@ -79,7 +79,7 @@ mp_err mp_sqrtmod_prime(const mp_int *n, const mp_int *prime, mp_int *ret)
    /* T = n ^ Q mod prime */
    if ((err = mp_copy(&S, &M)) != MP_OKAY)                       goto cleanup;
    /* M = S */
-   mp_set_u32(&two, 2uL);
+   mp_set_u32(&two, 2u);
 
    while (1) {
       if ((err = mp_copy(&T, &t1)) != MP_OKAY)                    goto cleanup;