Re: [PATCH] remove inline iteration variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 16 Aug 2006, Alex Riesen wrote:

> David Rientjes, Wed, Aug 16, 2006 19:14:44 +0200:
> > > > 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.

		David
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]