aboutsummaryrefslogtreecommitdiff
path: root/src/stdlib/print.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2026-02-14 16:18:37 -0500
committerBruce Hill <bruce@bruce-hill.com>2026-02-14 16:18:37 -0500
commit29b4aa20ae2a75808adbea63373a7f6c21ac9441 (patch)
tree93f3e344404538ee7784fa90a719df208a4911ec /src/stdlib/print.c
parent7292d6e5bbdcaf53887103dc783afde9d5616bcd (diff)
Bugfix for printing negative ints
Diffstat (limited to 'src/stdlib/print.c')
-rw-r--r--src/stdlib/print.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/stdlib/print.c b/src/stdlib/print.c
index 7da1343f..71ad4750 100644
--- a/src/stdlib/print.c
+++ b/src/stdlib/print.c
@@ -14,6 +14,7 @@ int _print_int(FILE *f, int64_t n) {
char buf[21] = {[20] = 0}; // Big enough for INT64_MIN + '\0'
char *p = &buf[19];
bool negative = n < 0;
+ if (negative) n = -n;
do {
*(p--) = '0' + (n % 10);