mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
mesa: Fix logbase2.
It was providing 1 too many for non power two values.
This commit is contained in:
parent
0c4350790a
commit
d4e6df9ab6
1 changed files with 5 additions and 7 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue