aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium/auxiliary/util/u_math.h
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-10-31 09:31:38 +0100
committermarha <marha@users.sourceforge.net>2012-10-31 09:31:38 +0100
commit5b22d4d5511efbd4fb0658c370edadd39829e39b (patch)
tree96a36b429ff2a0819653279a5e63a1bed79d4434 /mesalib/src/gallium/auxiliary/util/u_math.h
parent7bc456b7052b9591a58bfb6b509abb09d5464990 (diff)
parent67c290de36ddc1caae94c0892157ac16b90e4f99 (diff)
downloadvcxsrv-5b22d4d5511efbd4fb0658c370edadd39829e39b.tar.gz
vcxsrv-5b22d4d5511efbd4fb0658c370edadd39829e39b.tar.bz2
vcxsrv-5b22d4d5511efbd4fb0658c370edadd39829e39b.zip
Merge remote-tracking branch 'origin/released'
* origin/released: mesa git update 31 oct 2012
Diffstat (limited to 'mesalib/src/gallium/auxiliary/util/u_math.h')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_math.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_math.h b/mesalib/src/gallium/auxiliary/util/u_math.h
index 4047bd9b0..607fbecb0 100644
--- a/mesalib/src/gallium/auxiliary/util/u_math.h
+++ b/mesalib/src/gallium/auxiliary/util/u_math.h
@@ -482,12 +482,16 @@ unsigned ffs( unsigned u )
*/
static INLINE unsigned util_last_bit(unsigned u)
{
+#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 304)
+ return u == 0 ? 0 : 32 - __builtin_clz(u);
+#else
unsigned r = 0;
while (u) {
r++;
u >>= 1;
}
return r;
+#endif
}