[ros-kernel] Little speedup (Nope)

Filip Navara xnavara at volny.cz
Tue Mar 30 16:12:56 CEST 2004


Hi Waldo!

Waldo Alvarez Cañizares wrote:
...

>I think that something can be done about that loop unrolling. I mean, the compiler can unroll loops automatically, at least GCC can (maybe there is  a pragma or something to do it in a more controlled way, I do not have the documentation around)
>  
>
Yes, it can, with the -funroll-loops option.

>i.e.
> 
>I have not tested it or even compiled (I do not even know what that code doessince i don't have the sources around) but this should be equivalent to the new commit
> 
>for (k = 0; k < 32; k++)
>{
>  Source |= (DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left) + k, sy, ColorTranslation) << (7 - k));
>}
>  
>
No, no, no!!!
The thing is that the bit order in a byte was wrong. Your suggested 
version would do invalid shifts (7 - k, where k > 7) and wouldn't 
produce the correct result.

- Filip


More information about the Ros-kernel mailing list