Commit a0b8ce68f71ae233728919154a5298dd46cc383f

Francois Perrad 2015-11-13T17:47:30

use unsigned literal

diff --git a/tommath.h b/tommath.h
index 8e784e8..4c66e15 100644
--- a/tommath.h
+++ b/tommath.h
@@ -208,8 +208,8 @@ int mp_init_size(mp_int *a, int size);
 
 /* ---> Basic Manipulations <--- */
 #define mp_iszero(a) (((a)->used == 0) ? MP_YES : MP_NO)
-#define mp_iseven(a) ((((a)->used > 0) && (((a)->dp[0] & 1) == 0)) ? MP_YES : MP_NO)
-#define mp_isodd(a)  ((((a)->used > 0) && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO)
+#define mp_iseven(a) ((((a)->used > 0) && (((a)->dp[0] & 1u) == 0u)) ? MP_YES : MP_NO)
+#define mp_isodd(a)  ((((a)->used > 0) && (((a)->dp[0] & 1u) == 1u)) ? MP_YES : MP_NO)
 #define mp_isneg(a)  (((a)->sign != MP_ZPOS) ? MP_YES : MP_NO)
 
 /* set to zero */
diff --git a/tommath_private.h b/tommath_private.h
index 6e5aa53..bc7cd35 100644
--- a/tommath_private.h
+++ b/tommath_private.h
@@ -88,14 +88,14 @@ int func_name (mp_int * a, type b)                       \
   mp_zero (a);                                           \
                                                          \
   /* set four bits at a time */                          \
-  for (x = 0; x < (sizeof(type) * 2); x++) {             \
+  for (x = 0; x < (sizeof(type) * 2u); x++) {            \
     /* shift the number up four bits */                  \
     if ((res = mp_mul_2d (a, 4, a)) != MP_OKAY) {        \
       return res;                                        \
     }                                                    \
                                                          \
     /* OR in the top four bits of the source */          \
-    a->dp[0] |= (b >> ((sizeof(type) * 8) - 4)) & 15;    \
+    a->dp[0] |= (b >> ((sizeof(type) * 8u) - 4u)) & 15u; \
                                                          \
     /* shift the source up to the next four bits */      \
     b <<= 4;                                             \