On Sun, Jun 5, 2011 at 1:14 AM, Benjamin Bellec wrote: > So here is a v2 patch with a builtin GCC optimization which is the > fastest (thx Matt to point me to this solution). >
>From patch: + return (1 << (32 - __builtin_clz(x - 1))); I don't know if the use of gcc guarantees that int will always be 32 bit, otherwise maybe use sizeof(int)*8 instead of 32? Or even sizeof(int)*CHAR_BIT for good measures. Although probably the robots have taken over before this becomes necessary :) Tormod _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev