Re: [PATCH 1/4] sound/isa: use unsigned for loop index

From: Alexey Dobriyan
Date: Sun May 11 2008 - 12:27:20 EST


On Sun, May 11, 2008 at 05:08:32PM +0100, Ricardo Martins wrote:
> On Sun, 11 May 2008 20:43, Alexey Dobriyan wrote:
> > On Sun, May 11, 2008 at 02:50:33PM +0200, Julia Lawall wrote:
> > > A few more cases in the spirit of the patch "Trivial: Replacement of always
> > > >0 ints with unsigned ints" submitted by Ricardo Martins <ricardo@xxxxxxxxxxxx>
> >
> > And rationale for those would be ...?
>
> Acccording to the kernel-janitors TODO [1], Jeff Garzik suggested the following:
>
> 2) "unsigned int" is preferred to "int", it generates better asm code
> on all platforms except sh5. This replacement needs to be done manually,
> because often 'int' is required due to negative values -Exxx commonly
> passed as error values.
>
> Since (most) loop counters such as "int i" are always either zero or a positive
> number, they are perfect candidates for using unsigned int instead, imho.
> It goes without saying, that each case must be considered separately in
> case a negative value is indeed needed.
>
> [1] http://kernelnewbies.org/KernelJanitors/Todo

So you've checked disassembly in both cases and saw it's better?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/