MP_SET_SIGNED: add utype parameter
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
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; } \
}