Commit 150c47cce234c9e2ed8809dc3b337ba2c6b4e23c

Francois Perrad 2019-05-19T16:36:53

refactor literal suffix with u lowercase

diff --git a/bn_mp_get_int.c b/bn_mp_get_int.c
index b046c3d..e3571e1 100644
--- a/bn_mp_get_int.c
+++ b/bn_mp_get_int.c
@@ -7,6 +7,6 @@
 unsigned long mp_get_int(const mp_int *a)
 {
    /* force result to 32-bits always so it is consistent on non 32-bit platforms */
-   return mp_get_long(a) & 0xFFFFFFFFUL;
+   return mp_get_long(a) & 0xFFFFFFFFuL;
 }
 #endif
diff --git a/bn_mp_get_long.c b/bn_mp_get_long.c
index 4441d63..a800efb 100644
--- a/bn_mp_get_long.c
+++ b/bn_mp_get_long.c
@@ -19,7 +19,7 @@ unsigned long mp_get_long(const mp_int *a)
    /* get most significant digit of result */
    res = (unsigned long)a->dp[i];
 
-#if (ULONG_MAX != 0xFFFFFFFFUL) || (MP_DIGIT_BIT < 32)
+#if (ULONG_MAX != 0xFFFFFFFFuL) || (MP_DIGIT_BIT < 32)
    while (--i >= 0) {
       res = (res << MP_DIGIT_BIT) | (unsigned long)a->dp[i];
    }
diff --git a/bn_mp_set_double.c b/bn_mp_set_double.c
index 98a8248..9e00362 100644
--- a/bn_mp_set_double.c
+++ b/bn_mp_set_double.c
@@ -15,8 +15,8 @@ mp_err mp_set_double(mp_int *a, double b)
    } cast;
    cast.dbl = b;
 
-   exp = (int)((unsigned)(cast.bits >> 52) & 0x7FFU);
-   frac = (cast.bits & ((1ULL << 52) - 1ULL)) | (1ULL << 52);
+   exp = (int)((unsigned)(cast.bits >> 52) & 0x7FFu);
+   frac = (cast.bits & ((1uLL << 52) - 1uLL)) | (1uLL << 52);
 
    if (exp == 0x7FF) { /* +-inf, NaN */
       return MP_VAL;
@@ -30,7 +30,7 @@ mp_err mp_set_double(mp_int *a, double b)
       return err;
    }
 
-   if (((cast.bits >> 63) != 0ULL) && !MP_IS_ZERO(a)) {
+   if (((cast.bits >> 63) != 0uLL) && !MP_IS_ZERO(a)) {
       a->sign = MP_NEG;
    }
 
diff --git a/bn_mp_set_int.c b/bn_mp_set_int.c
index a322580..f0c7434 100644
--- a/bn_mp_set_int.c
+++ b/bn_mp_set_int.c
@@ -6,6 +6,6 @@
 /* set a 32-bit const */
 mp_err mp_set_int(mp_int *a, unsigned long b)
 {
-   return mp_set_long(a, b & 0xFFFFFFFFUL);
+   return mp_set_long(a, b & 0xFFFFFFFFuL);
 }
 #endif
diff --git a/demo/test.c b/demo/test.c
index 69c8fbc..e7dd9ff 100644
--- a/demo/test.c
+++ b/demo/test.c
@@ -1239,7 +1239,7 @@ static int test_mp_reduce_2k_l(void)
    mp_copy(&b, &c);
    printf("Testing: mp_reduce_2k_l...");
    fflush(stdout);
-   for (cnt = 0; cnt < (int)(1UL << 20); cnt++) {
+   for (cnt = 0; cnt < (int)(1uL << 20); cnt++) {
       mp_sqr(&b, &b);
       mp_add_d(&b, 1uL, &b);
       mp_reduce_2k_l(&b, &a, &d);