diff options
author | Peter Wemm <peter@FreeBSD.org> | 2003-11-06 01:24:25 +0000 |
---|---|---|
committer | Peter Wemm <peter@FreeBSD.org> | 2003-11-06 01:24:25 +0000 |
commit | 6350f49c4a226a478549b28fd0a67c2aa8e58193 (patch) | |
tree | 60231ee958121a2bc115413640571fe508927597 /sys/i386 | |
parent | 42944f1e2ec1a3e7bc952322ff579b01255fbc8a (diff) | |
download | src-6350f49c4a226a478549b28fd0a67c2aa8e58193.tar.gz src-6350f49c4a226a478549b28fd0a67c2aa8e58193.zip |
OK, this might be a bit silly, but add another popcnt() candidate.
Notes
Notes:
svn path=/head/; revision=122156
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/i386/mp_machdep.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c index a826dd8e8b03..f0b1d4317d3d 100644 --- a/sys/i386/i386/mp_machdep.c +++ b/sys/i386/i386/mp_machdep.c @@ -915,6 +915,12 @@ smp_tlb_shootdown(u_int vector, vm_offset_t addr1, vm_offset_t addr2) * -mcpu=pentiumpro and -march=pentiumpro then gcc-3.1 will use * an imull, and in that case it is faster. In most other cases * it appears slightly slower. + * + * Another variant (also from fortune): + * #define BITCOUNT(x) (((BX_(x)+(BX_(x)>>4)) & 0x0F0F0F0F) % 255) + * #define BX_(x) ((x) - (((x)>>1)&0x77777777) \ + * - (((x)>>2)&0x33333333) \ + * - (((x)>>3)&0x11111111)) */ static __inline u_int32_t popcnt(u_int32_t m) |