aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorJesse Barnes <[email protected]>2010-04-19 09:56:49 -0700
committerJesse Barnes <[email protected]>2010-04-19 09:56:49 -0700
commit64644ec3b21884d4a974fa29087fa98c4ed9e112 (patch)
treed5752ba82220f9ebe5d61d7e98ecc27f331aa65c /src/mesa/main
parent4df3e76949e1ca7b29f844ad9a715b442396a024 (diff)
parent385e2896ebf54ac0b016132fe513f21a5b67ba4f (diff)
Merge branch '7.8'
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/imports.c3
-rw-r--r--src/mesa/main/imports.h6
2 files changed, 6 insertions, 3 deletions
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 1ae08533648..b1389b25f2a 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -564,7 +564,8 @@ _mesa_ffsll(int64_t val)
unsigned int
_mesa_bitcount(unsigned int n)
{
-#if defined(__GNUC__)
+#if defined(__GNUC__) && \
+ ((_GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ >= 4)
return __builtin_popcount(n);
#else
unsigned int bits;
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index d28f4ad125d..1c263aabca1 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -404,7 +404,8 @@ _mesa_is_pow_two(int x)
static INLINE int32_t
_mesa_next_pow_two_32(uint32_t x)
{
-#ifdef __GNUC__
+#if defined(__GNUC__) && \
+ ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ >= 4)
uint32_t y = (x != 1);
return (1 + y) << ((__builtin_clz(x - y) ^ 31) );
#else
@@ -422,7 +423,8 @@ _mesa_next_pow_two_32(uint32_t x)
static INLINE int64_t
_mesa_next_pow_two_64(uint64_t x)
{
-#ifdef __GNUC__
+#if defined(__GNUC__) && \
+ ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ >= 4)
uint64_t y = (x != 1);
if (sizeof(x) == sizeof(long))
return (1 + y) << ((__builtin_clzl(x - y) ^ 63));