mesa: Fix build with gcc 3.3.
authorMatthieu Herrb <matthieu.herrb@laas.fr>
Mon, 19 Apr 2010 15:32:37 +0000 (09:32 -0600)
committerBrian Paul <brianp@vmware.com>
Mon, 19 Apr 2010 15:33:53 +0000 (09:33 -0600)
Signed-off-by: Brian Paul <brianp@vmware.com>
src/mesa/main/imports.c
src/mesa/main/imports.h

index 1ae0853..b1389b2 100644 (file)
@@ -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;
index d28f4ad..1c263aa 100644 (file)
@@ -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));