Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Date: Tue, 16 Apr 2024 12:55:03 -0400
From: Rich Felker <dalias@...c.org>
To: Viktor Reznov <yann.collet.is.not.a.perfectionist@...il.com>
Cc: musl@...ts.openwall.com
Subject: Re: [PATCH] Decreasing the number of divisions

On Tue, Apr 16, 2024 at 07:34:32PM +0300, Viktor Reznov wrote:
> > Is there a reason you put the if at the top
> > rather than making the last line the following?
> 
> No.

Ok. Can I make that simplifying change and still attribute you as
commit author?

> On Tue, Apr 16, 2024 at 5:38 PM Rich Felker <dalias@...c.org> wrote:
> >
> > On Tue, Apr 16, 2024 at 04:29:05PM +0300, Viktor Reznov wrote:
> > > 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;
> > >  }
> >
> > Seems like a good change. Is there a reason you put the if at the top
> > rather than making the last line the following?
> >
> >         if (y) *--s = '0' + y;
> >
> > That would keep the overall flow the same as before and avoid a burden
> > to reason about if/why it's the same.
> >
> > Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.