From 33636c82366b3029db072bd5ef6cce8f7649a75e Mon Sep 17 00:00:00 2001 From: kalsprite Date: Thu, 6 Aug 2026 21:40:32 -0700 Subject: [PATCH] fix bigint negative prints --- src/big_int.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/big_int.cpp b/src/big_int.cpp index ffb7a6ad6..6db3301da 100644 --- a/src/big_int.cpp +++ b/src/big_int.cpp @@ -694,7 +694,9 @@ gb_internal String big_int_to_string(gbAllocator allocator, BigInt const *x, u64 big_int_dealloc(&r); big_int_dealloc(&b); - for (isize i = first_word_idx; i < buf.count/2; i++) { + // NOTE: only the digits are reversed, not the leading '-'. + isize digit_count = buf.count - first_word_idx; + for (isize i = first_word_idx; i < first_word_idx + digit_count/2; i++) { isize j = buf.count + first_word_idx - i - 1; char tmp = buf[i]; buf[i] = buf[j];