diff options
author | José Fonseca <[email protected]> | 2009-07-16 19:20:25 +0100 |
---|---|---|
committer | José Fonseca <[email protected]> | 2009-07-16 19:20:25 +0100 |
commit | d4e6df9ab6e7b707278e3739abee776418c6f527 (patch) | |
tree | c7c515f743600b1e8921e09df5eac9e7f2f32b8f | |
parent | 0c4350790ac0639996cbefcf2556ca5748d39454 (diff) |
mesa: Fix logbase2.
It was providing 1 too many for non power two values.
-rw-r--r-- | src/mesa/state_tracker/st_cb_texture.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 22685bd5d95..15f84b66382 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -237,14 +237,12 @@ do_memcpy(void *dest, const void *src, size_t n) } -static int -logbase2(int n) +static INLINE unsigned +logbase2(unsigned n) { - GLint i = 1, log2 = 0; - while (n > i) { - i *= 2; - log2++; - } + unsigned log2 = 0; + while (n >>= 1) + ++log2; return log2; } |