Re: [PATCH] remove inline iteration variable

From: Alex Riesen <raa.lkml@gmail.com>
Date: 2006-08-17 19:11:44
On 8/16/06, David Rientjes <rientjes@google.com> wrote:
> > > > > Remove unnecessary iteration variable in inline.
> > > > > -       for (i = 0; i < in; i++) putchar(' ');
> > > > > +       for (; in > 0; in--)
> > > >
> > > > while(in--) putchar(' ');
> > > >
> > >
> > > That goes into an infinite loop if the argument is negative because
> > > it emits a cmpl $0, x(%ebp).  Should never happen, but there's no
> > > reason not to prevent it with a for loop.
> >
> > while (in-- > 0) putchar(' ');
> >
> > still shorter :)
> >
>
> It emits a slightly rearranged assembly with the same number of instructions.
>

oops. I should've looked at the output. But the point moot anyway, Junio says :)
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Thu Aug 17 19:12:30 2006

This archive was generated by hypermail 2.1.8 : 2006-08-17 19:13:06 EST