summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/imports.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-11-23 18:09:46 -0700
committerBrian Paul <[email protected]>2009-11-23 18:09:46 -0700
commit863ad9a68388979e1d305f8689146e18ef4f098c (patch)
tree243d9605a37117e73f4894faa514f895a03bdb66 /src/mesa/main/imports.c
parent8d80b5400a1bbf4e959cd8257d11dfe0483e93db (diff)
mesa: use gcc __builtin_popcount()
Diffstat (limited to 'src/mesa/main/imports.c')
-rw-r--r--src/mesa/main/imports.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 46ffb929b6c..c9e00cf7528 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -629,11 +629,15 @@ _mesa_ffsll(int64_t val)
unsigned int
_mesa_bitcount(unsigned int n)
{
+#if defined(__GNUC__)
+ return __builtin_popcount(n);
+#else
unsigned int bits;
for (bits = 0; n > 0; n = n >> 1) {
bits += (n & 1);
}
return bits;
+#endif
}