projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0c43507
)
mesa: Fix logbase2.
author
José Fonseca
<jfonseca@vmware.com>
Thu, 16 Jul 2009 18:20:25 +0000
(19:20 +0100)
committer
José Fonseca
<jfonseca@vmware.com>
Thu, 16 Jul 2009 18:20:25 +0000
(19:20 +0100)
It was providing 1 too many for non power two values.
src/mesa/state_tracker/st_cb_texture.c
patch
|
blob
|
history
diff --git
a/src/mesa/state_tracker/st_cb_texture.c
b/src/mesa/state_tracker/st_cb_texture.c
index 22685bd5d95548191317274a11b5c65d6c18baa0..15f84b66382e6d7abc7c206b64388bc04057fa65 100644
(file)
--- 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;
}