(__sched_cpucount): Allow using special instruction for counting bits.

This commit is contained in:
Ulrich Drepper 2007-06-08 18:29:24 +00:00
parent 47779a7d3c
commit 7d0e41cebe
1 changed files with 7 additions and 3 deletions

View File

@ -30,6 +30,9 @@ __sched_cpucount (size_t setsize, cpu_set_t *setp)
if (l == 0) if (l == 0)
continue; continue;
#ifdef POPCNT
s += POPCNT (l);
#else
# if LONG_BIT > 32 # if LONG_BIT > 32
l = (l & 0x5555555555555555ul) + ((l >> 1) & 0x5555555555555555ul); l = (l & 0x5555555555555555ul) + ((l >> 1) & 0x5555555555555555ul);
l = (l & 0x3333333333333333ul) + ((l >> 2) & 0x3333333333333333ul); l = (l & 0x3333333333333333ul) + ((l >> 2) & 0x3333333333333333ul);
@ -46,6 +49,7 @@ __sched_cpucount (size_t setsize, cpu_set_t *setp)
# endif # endif
s += l; s += l;
#endif
} }
return s; return s;