Commit 38116079e47e9c84cd39e61505370df43f446dad

Francois Perrad 2019-05-13T17:51:07

literal suffix

diff --git a/bn_s_mp_rand_jenkins.c b/bn_s_mp_rand_jenkins.c
index 605db29..a310bea 100644
--- a/bn_s_mp_rand_jenkins.c
+++ b/bn_s_mp_rand_jenkins.c
@@ -28,9 +28,9 @@ static uint64_t s_rand_jenkins_val(void)
 void s_mp_rand_jenkins_init(uint64_t seed)
 {
    uint64_t i;
-   jenkins_x.a = 0xf1ea5eed;
+   jenkins_x.a = 0xf1ea5eedULL;
    jenkins_x.b = jenkins_x.c = jenkins_x.d = seed;
-   for (i = 0; i < 20; ++i) {
+   for (i = 0uLL; i < 20uLL; ++i) {
       (void)s_rand_jenkins_val();
    }
 }
@@ -38,11 +38,11 @@ void s_mp_rand_jenkins_init(uint64_t seed)
 int s_mp_rand_jenkins(void *p, size_t n)
 {
    char *q = (char *)p;
-   while (n > 0) {
+   while (n > 0u) {
       int i;
       uint64_t x = s_rand_jenkins_val();
-      for (i = 0; (i < 8) && (n > 0); ++i, --n) {
-         *q++ = (char)(x & 0xFF);
+      for (i = 0; (i < 8) && (n > 0u); ++i, --n) {
+         *q++ = (char)(x & 0xFFuLL);
          x >>= 8;
       }
    }
diff --git a/bn_s_mp_rand_platform.c b/bn_s_mp_rand_platform.c
index 6e04ed5..ec2f008 100644
--- a/bn_s_mp_rand_platform.c
+++ b/bn_s_mp_rand_platform.c
@@ -52,7 +52,7 @@ static int s_read_win_csp(void *p, size_t n)
 static int s_read_getrandom(void *p, size_t n)
 {
    char *q = (char *)p;
-   while (n > 0) {
+   while (n > 0u) {
       ssize_t ret = getrandom(q, n, 0);
       if (ret < 0) {
          if (errno == EINTR) {
@@ -89,7 +89,7 @@ static int s_read_dev_urandom(void *p, size_t n)
    } while ((fd == -1) && (errno == EINTR));
    if (fd == -1) return MP_ERR;
 
-   while (n > 0) {
+   while (n > 0u) {
       ssize_t ret = read(fd, p, n);
       if (ret < 0) {
          if (errno == EINTR) {
diff --git a/tommath.h b/tommath.h
index 353234a..9603167 100644
--- a/tommath.h
+++ b/tommath.h
@@ -151,7 +151,7 @@ TOOM_SQR_CUTOFF;
 #endif
 
 /* size of comba arrays, should be at least 2 * 2**(BITS_PER_WORD - BITS_PER_DIGIT*2) */
-#define PRIVATE_MP_WARRAY (1u << (((CHAR_BIT * sizeof(mp_word)) - (2 * MP_DIGIT_BIT)) + 1))
+#define PRIVATE_MP_WARRAY (1uLL << (((CHAR_BIT * sizeof(mp_word)) - (2 * MP_DIGIT_BIT)) + 1))
 #define MP_WARRAY (MP_DEPRECATED_PRAGMA("MP_WARRAY is an internal macro") PRIVATE_MP_WARRAY)
 
 #if defined(__GNUC__) && __GNUC__ >= 4
diff --git a/tommath_private.h b/tommath_private.h
index 73495d7..7716dce 100644
--- a/tommath_private.h
+++ b/tommath_private.h
@@ -139,7 +139,7 @@ extern void MP_FREE(void *mem, size_t size);
 #define MP_IS_ODD(a)  (((a)->used > 0) && (((a)->dp[0] & 1u) == 1u))
 
 #define MP_SIZEOF_BITS(type)    (CHAR_BIT * sizeof(type))
-#define MP_MAXFAST              (int)(1u << (MP_SIZEOF_BITS(mp_word) - (2u * (size_t)MP_DIGIT_BIT)))
+#define MP_MAXFAST              (int)(1uL << (MP_SIZEOF_BITS(mp_word) - (2u * (size_t)MP_DIGIT_BIT)))
 
 /* random number source */
 extern int (*s_mp_rand_source)(void *out, size_t size);