From 67c290de36ddc1caae94c0892157ac16b90e4f99 Mon Sep 17 00:00:00 2001 From: marha Date: Wed, 31 Oct 2012 09:21:05 +0100 Subject: mesa git update 31 oct 2012 mesa: 183e122bdfe27f875c3c121964484dae9587c051 --- mesalib/src/gallium/auxiliary/util/u_math.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'mesalib/src/gallium/auxiliary/util/u_math.h') 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 } -- cgit v1.2.3