Wolfgang Denk <w...@denx.de> wrote on 08/10/2009 14:49:15:
>
> Dear Joakim Tjernlund,
>
> In message <OF26FEA2CB.36E102EE-ONC1257649.0031301D-C1257649.
> 0031e...@transmode.se> you wrote:
> >
> > > How about:
> > >
> > >       cl = 0;
> > >       for (i=0; i<sizeof(long); ++i) {
> > >          cl <<= 8;
> > >          cl |= c & 0xff;
> > >       }
> > >
> > > GCC optimization will do the rest...
> >
> > If you want gcc to optimise well, make it easy to do so.
> > Changing the for loop into:
> >       for (i=sizeof(long); i; --i)
> > makes it easier for gcc and more likely to result in optimal code.
>
> Did you actually _check_ the code? (I did).

No, but I have done this in the past and found that
gcc does stupid things sometimes, especially loops, and
it depends on arch and gcc version.

>
> It does not matter. The generated code is identical.

So my question is: Did you check all gcc versions and
arches?

 Jocke



_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to