mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] [PATCH] Decreasing the number of divisions
@ 2024-04-16 13:29 Viktor Reznov
  2024-04-16 14:29 ` Markus Wichmann
  2024-04-16 14:38 ` Rich Felker
  0 siblings, 2 replies; 7+ messages in thread
From: Viktor Reznov @ 2024-04-16 13:29 UTC (permalink / raw)
  To: musl

diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c
index 497c5e19..0f9a1e6a 100644
--- a/src/stdio/vfprintf.c
+++ b/src/stdio/vfprintf.c
@@ -165,8 +165,10 @@ static char *fmt_o(uintmax_t x, char *s)
 static char *fmt_u(uintmax_t x, char *s)
 {
        unsigned long y;
+       if (x == 0) return s;
        for (   ; x>ULONG_MAX; x/=10) *--s = '0' + x%10;
-       for (y=x;           y; y/=10) *--s = '0' + y%10;
+       for (y=x;       y>=10; y/=10) *--s = '0' + y%10;
+       *--s = '0' + y;
        return s;
 }

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-04-17  1:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-16 13:29 [musl] [PATCH] Decreasing the number of divisions Viktor Reznov
2024-04-16 14:29 ` Markus Wichmann
2024-04-17  1:25   ` NRK
2024-04-17  1:56     ` Markus Wichmann
2024-04-16 14:38 ` Rich Felker
     [not found]   ` <CAKs8_OKqKsLbG_Cf0DtDGeZDLdFkO1kDx6z5Fg_rQwPxPLGP6g@mail.gmail.com>
2024-04-16 16:55     ` Rich Felker
     [not found]       ` <CAKs8_OJ4evmTzAGVZ1Yccw+4Jj7v=RwEJWicwbSoeQwbvqav1Q@mail.gmail.com>
2024-04-17  0:09         ` [musl] " Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).