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 <lh_mouse@126.com>
diff --git a/mingw-w64-crt/stdio/mingw_pformat.c b/mingw-w64-crt/stdio/mingw_pformat.c
index fc7429b..25ceffb 100644
--- a/mingw-w64-crt/stdio/mingw_pformat.c
+++ b/mingw-w64-crt/stdio/mingw_pformat.c
@@ -779,8 +779,8 @@
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++ = ',';
}