On Sun, Jun 5, 2011 at 11:34 AM, Ian Romanick <i...@freedesktop.org> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 06/02/2011 04:40 PM, Brian Paul wrote: >> On 06/02/2011 03:18 PM, Benjamin Bellec wrote: >>> It's me again, with a new minor optimization for the >>> util_next_power_of_two() function. >>> >>> This patch implements a faster algorithm, still taken from Wikipedia ( >>> http://en.wikipedia.org/wiki/Power_of_two#Algorithm_to_round_up_to_power_of_two >>> >>> ). >>> But especially, I added the most common values used by this function. I >>> noted that ETQW, TA Spring and ExtremeTuxRacer call often "good" values. >>> I can think that most OpenGL apps uses also these values. >>> >>> I have benchmarked this. With -O2 optimization, this new function is >>> twice faster than the former. Without GCC optimization the difference is >>> even bigger. >>> >>> There is no piglit regressions. >>> >>> But there is an issue, during compilation there is an error (-Wall) >>> "warning: right shift count>= width of type [enabled by default]". >> >> I'd like to avoid the warning if at all possible. If you replace (val >>>> 32) with (val >> (sizeof(unsigned) * 4)) does that silence it? > > It will because it will evaluate to val >> 16, which is not what's wanted.
It would evaluate to 32 (8*4) when relevant. Please note the conditional. -Brian _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev