aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-02-22 15:03:18 +0000
committermarha <marha@users.sourceforge.net>2011-02-22 15:03:18 +0000
commitaa5b2e956fcc17b27d0f20ba7af65c52b34ef135 (patch)
tree6117dbd9745f6fa241d5ca19af20d1c3adb6e859 /mesalib/src/mesa/main
parent2d47702332ee534cda7f913e8d7892e53e4e23dc (diff)
parent9273afeeb4499a0493f120b7525e17b6ae51113e (diff)
downloadvcxsrv-aa5b2e956fcc17b27d0f20ba7af65c52b34ef135.tar.gz
vcxsrv-aa5b2e956fcc17b27d0f20ba7af65c52b34ef135.tar.bz2
vcxsrv-aa5b2e956fcc17b27d0f20ba7af65c52b34ef135.zip
svn merge ^/branches/released .
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/imports.c13
-rw-r--r--mesalib/src/mesa/main/imports.h13
2 files changed, 17 insertions, 9 deletions
diff --git a/mesalib/src/mesa/main/imports.c b/mesalib/src/mesa/main/imports.c
index f98098230..3f856402f 100644
--- a/mesalib/src/mesa/main/imports.c
+++ b/mesalib/src/mesa/main/imports.c
@@ -453,6 +453,7 @@ _mesa_inv_sqrtf(float n)
#endif
}
+#ifndef __GNUC__
/**
* Find the first bit set in a word.
*/
@@ -496,9 +497,6 @@ _mesa_ffs(int32_t i)
int
_mesa_ffsll(int64_t val)
{
-#ifdef ffsll
- return ffsll(val);
-#else
int bit;
assert(sizeof(val) == 8);
@@ -512,27 +510,24 @@ _mesa_ffsll(int64_t val)
return 32 + bit;
return 0;
-#endif
}
+#if ((_GNUC__ == 3 && __GNUC_MINOR__ < 4) || __GNUC__ < 4)
/**
* Return number of bits set in given GLuint.
*/
unsigned int
_mesa_bitcount(unsigned int n)
{
-#if defined(__GNUC__) && \
- ((_GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ >= 4)
- return __builtin_popcount(n);
-#else
unsigned int bits;
for (bits = 0; n > 0; n = n >> 1) {
bits += (n & 1);
}
return bits;
-#endif
}
+#endif
+#endif
/**
diff --git a/mesalib/src/mesa/main/imports.h b/mesalib/src/mesa/main/imports.h
index af7a8cc00..9922f43e3 100644
--- a/mesalib/src/mesa/main/imports.h
+++ b/mesalib/src/mesa/main/imports.h
@@ -539,6 +539,18 @@ _mesa_inv_sqrtf(float x);
extern void
_mesa_init_sqrt_table(void);
+#ifdef __GNUC__
+#define _mesa_ffs(i) ffs(i)
+#define _mesa_ffsll(i) ffsll(i)
+
+#if ((_GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ >= 4)
+#define _mesa_bitcount(i) __builtin_popcount(i)
+#else
+extern unsigned int
+_mesa_bitcount(unsigned int n);
+#endif
+
+#else
extern int
_mesa_ffs(int32_t i);
@@ -547,6 +559,7 @@ _mesa_ffsll(int64_t i);
extern unsigned int
_mesa_bitcount(unsigned int n);
+#endif
extern GLhalfARB
_mesa_float_to_half(float f);