From dba1db27ab36b4c0e3a7111c2f0fc61dfab8fa5a Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Wed, 20 May 2020 23:09:29 -0500 Subject: [PATCH] Bugfix for negatives in bh_printf --- bh.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bh.h b/bh.h index 26ff3bc0..282608ae 100644 --- a/bh.h +++ b/bh.h @@ -1337,9 +1337,11 @@ isize bh__printi64(char* str, isize n, bh__print_format format, i64 value) { char buf[128]; buf[127] = 0; char* walker = buf + 127; - b32 negative = value < 0; u32 base = format.base ? format.base : 10, tmp; + b32 negative = value < 0; + if (negative) value = -value; + if (value == 0) { *--walker = '0'; } else { -- 2.25.1