Commit 8cf0d3db854b942ae9d88322bc7f9e21fe65b5b0

Francois Perrad 2019-09-07T12:28:26

literal suffix

diff --git a/bn_mp_div_d.c b/bn_mp_div_d.c
index 33bee91..b9d718b 100644
--- a/bn_mp_div_d.c
+++ b/bn_mp_div_d.c
@@ -29,7 +29,7 @@ mp_err mp_div_d(const mp_int *a, mp_digit b, mp_int *c, mp_digit *d)
    }
 
    /* power of two ? */
-   if ((b & (b-1)) == 0u) {
+   if ((b & (b - 1u)) == 0u) {
       ix = 1;
       while ((ix < MP_DIGIT_BIT) && (b != (((mp_digit)1)<<ix))) {
          ix++;
diff --git a/bn_mp_to_radix.c b/bn_mp_to_radix.c
index 6e99777..6b03ee7 100644
--- a/bn_mp_to_radix.c
+++ b/bn_mp_to_radix.c
@@ -16,7 +16,7 @@ mp_err mp_to_radix(const mp_int *a, char *str, size_t maxlen, int radix)
    char   *_s = str;
 
    /* check range of the maxlen, radix */
-   if ((maxlen < 2) || (radix < 2) || (radix > 64)) {
+   if ((maxlen < 2u) || (radix < 2) || (radix > 64)) {
       return MP_VAL;
    }
 
@@ -46,7 +46,7 @@ mp_err mp_to_radix(const mp_int *a, char *str, size_t maxlen, int radix)
 
    digs = 0;
    while (!MP_IS_ZERO(&t)) {
-      if (--maxlen < 1) {
+      if (--maxlen < 1u) {
          /* no more room */
          err = MP_VAL;
          break;
diff --git a/tommath_private.h b/tommath_private.h
index 4c25fa0..b565042 100644
--- a/tommath_private.h
+++ b/tommath_private.h
@@ -143,7 +143,7 @@ extern void MP_FREE(void *mem, size_t size);
 /* feature detection macro */
 #define MP_STRINGIZE(x)  MP__STRINGIZE(x)
 #define MP__STRINGIZE(x) ""#x""
-#define MP_HAS(x)        (sizeof(MP_STRINGIZE(BN_##x##_C)) == 1)
+#define MP_HAS(x)        (sizeof(MP_STRINGIZE(BN_##x##_C)) == 1u)
 
 /* TODO: Remove private_mp_word as soon as deprecated mp_word is removed from tommath. */
 #undef mp_word