aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/mprintf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/mprintf.c b/lib/mprintf.c
index 1e5235769..1bbf53ade 100644
--- a/lib/mprintf.c
+++ b/lib/mprintf.c
@@ -776,10 +776,11 @@ static int dprintf_formatf(
/* Decimal integer. */
base = 10;
- is_neg = (p->data.num.as_signed < (mp_intmax_t)0) ? 1 : 0;
+ signed_num = p->data.num.as_signed;
+ is_neg = (signed_num < (mp_intmax_t)0) ? 1 : 0;
if(is_neg) {
/* signed_num might fail to hold absolute negative minimum by 1 */
- signed_num = p->data.num.as_signed + (mp_intmax_t)1;
+ signed_num += (mp_intmax_t)1;
signed_num = -signed_num;
num = (mp_uintmax_t)signed_num;
num += (mp_uintmax_t)0x1;