Commit 8cf4363992b469ce4491c65e8ea6f7b0797636f4

Daniel Mendler 2019-06-06T23:14:15

MP_SET_SIGNED: add utype parameter

diff --git a/bn_mp_set_i32.c b/bn_mp_set_i32.c
index abf1f94..df4513d 100644
--- a/bn_mp_set_i32.c
+++ b/bn_mp_set_i32.c
@@ -3,5 +3,5 @@
 /* LibTomMath, multiple-precision integer library -- Tom St Denis */
 /* SPDX-License-Identifier: Unlicense */
 
-MP_SET_SIGNED(mp_set_i32, mp_set_u32, int32_t)
+MP_SET_SIGNED(mp_set_i32, mp_set_u32, int32_t, uint32_t)
 #endif
diff --git a/bn_mp_set_i64.c b/bn_mp_set_i64.c
index 6772dfe..395103b 100644
--- a/bn_mp_set_i64.c
+++ b/bn_mp_set_i64.c
@@ -3,5 +3,5 @@
 /* LibTomMath, multiple-precision integer library -- Tom St Denis */
 /* SPDX-License-Identifier: Unlicense */
 
-MP_SET_SIGNED(mp_set_i64, mp_set_u64, int64_t)
+MP_SET_SIGNED(mp_set_i64, mp_set_u64, int64_t, uint64_t)
 #endif
diff --git a/tommath_private.h b/tommath_private.h
index f37b541..ad59c04 100644
--- a/tommath_private.h
+++ b/tommath_private.h
@@ -246,10 +246,10 @@ MP_DEPRECATED(s_mp_reverse) void bn_reverse(unsigned char *s, int len);
         MP_ZERO_DIGITS(a->dp + a->used, a->alloc - a->used);                           \
     }
 
-#define MP_SET_SIGNED(name, uname, type)                 \
+#define MP_SET_SIGNED(name, uname, type, utype)          \
     void name(mp_int * a, type b)                        \
     {                                                    \
-        uname(a, (b < 0) ? -(u##type)b : (u##type)b);    \
+        uname(a, (b < 0) ? -(utype)b : (utype)b);        \
         if (b < 0) { a->sign = MP_NEG; }                 \
     }