aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium/auxiliary/util/u_math.h
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-06-03 08:18:04 +0200
committermarha <marha@users.sourceforge.net>2011-06-03 08:18:04 +0200
commitcda19b1d226d565f1ca4327aeae827c621b3dfd6 (patch)
tree8a511d718c888b17c257a905607068613359f9a6 /mesalib/src/gallium/auxiliary/util/u_math.h
parent4d7ec99788d8a1d56ff4bccea279ae8186b18cdc (diff)
downloadvcxsrv-cda19b1d226d565f1ca4327aeae827c621b3dfd6.tar.gz
vcxsrv-cda19b1d226d565f1ca4327aeae827c621b3dfd6.tar.bz2
vcxsrv-cda19b1d226d565f1ca4327aeae827c621b3dfd6.zip
xserver xkeyboard-config mesa git update 3 Jun 2011
Diffstat (limited to 'mesalib/src/gallium/auxiliary/util/u_math.h')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_math.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_math.h b/mesalib/src/gallium/auxiliary/util/u_math.h
index 2ecade5f7..65a99fcb3 100644
--- a/mesalib/src/gallium/auxiliary/util/u_math.h
+++ b/mesalib/src/gallium/auxiliary/util/u_math.h
@@ -477,10 +477,13 @@ float_to_byte_tex(float f)
static INLINE unsigned
util_logbase2(unsigned n)
{
- unsigned log2 = 0;
- while (n >>= 1)
- ++log2;
- return log2;
+ unsigned pos = 0;
+ if (n >= 1<<16) { n >>= 16; pos += 16; }
+ if (n >= 1<< 8) { n >>= 8; pos += 8; }
+ if (n >= 1<< 4) { n >>= 4; pos += 4; }
+ if (n >= 1<< 2) { n >>= 2; pos += 2; }
+ if (n >= 1<< 1) { pos += 1; }
+ return pos;
}