mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 13:10:10 +01:00
mesa: use gcc __builtin_popcount()
This commit is contained in:
parent
8d80b5400a
commit
863ad9a683
1 changed files with 4 additions and 0 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue