On Fri, 28 Nov 2025, LIU Hao wrote:

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++ = ',';
      }
--

Same as for the other patch; I can't really say by just looking at the patch, but if you've studied it, and this improves conformance with testsuites, I presume it's ok.

// Martin



_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to