This uses the same pattern with the other non-printf128 path. Here digits are written backwards i.e. from the least significant end to the most significant end, so they are counted as `p` is increased i.e. in humans' order from right to left.
Signed-off-by: LIU Hao <[email protected]> --- mingw-w64-crt/stdio/mingw_pformat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mingw-w64-crt/stdio/mingw_pformat.c b/mingw-w64-crt/stdio/mingw_pformat.c index fc7429ba4..25ceffb50 100644 --- a/mingw-w64-crt/stdio/mingw_pformat.c +++ b/mingw-w64-crt/stdio/mingw_pformat.c @@ -779,8 +779,8 @@ void __pformat_int( __pformat_intarg_t value, __pformat_t *stream ) memset(p,0,bufflen); for(int32_t i = strlen(tmp_buff) - 1; i >= 0; i--){ - if ( i && (stream->flags & PFORMAT_GROUPED) != 0 && stream->thousands_chr != 0 - && (i % 4) == 3) + if (p != buf && (stream->flags & PFORMAT_GROUPED) != 0 && stream->thousands_chr != 0 + && ((p - buf) % 4) == 3) { *p++ = ','; } -- 2.52.0
From 81475bb898ff733c3a9969f5b210b62bafb3a675 Mon Sep 17 00:00:00 2001 From: LIU Hao <[email protected]> Date: Thu, 27 Nov 2025 21:51:55 +0800 Subject: [PATCH] crt/stdio: Fix thosand separators in printf128 This uses the same pattern with the other non-printf128 path. Here digits are written backwards i.e. from the least significant end to the most significant end, so they are counted as `p` is increased i.e. in humans' order from right to left. Signed-off-by: LIU Hao <[email protected]> --- mingw-w64-crt/stdio/mingw_pformat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mingw-w64-crt/stdio/mingw_pformat.c b/mingw-w64-crt/stdio/mingw_pformat.c index fc7429ba4..25ceffb50 100644 --- a/mingw-w64-crt/stdio/mingw_pformat.c +++ b/mingw-w64-crt/stdio/mingw_pformat.c @@ -779,8 +779,8 @@ void __pformat_int( __pformat_intarg_t value, __pformat_t *stream ) memset(p,0,bufflen); for(int32_t i = strlen(tmp_buff) - 1; i >= 0; i--){ - if ( i && (stream->flags & PFORMAT_GROUPED) != 0 && stream->thousands_chr != 0 - && (i % 4) == 3) + if (p != buf && (stream->flags & PFORMAT_GROUPED) != 0 && stream->thousands_chr != 0 + && ((p - buf) % 4) == 3) { *p++ = ','; } -- 2.52.0
OpenPGP_signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
