Date: Sun, 14 Sep 2003 17:02:35 -0700 (PDT) From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 38065 for review Message-ID: <200309150002.h8F02ZM7045982@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=38065 Change 38065 by peter@peter_work on 2003/09/14 17:01:54 Update the popcnt() stuff Affected files ... .. //depot/projects/hammer/sys/i386/i386/mp_machdep.c#13 edit Differences ... ==== //depot/projects/hammer/sys/i386/i386/mp_machdep.c#13 (text+ko) ==== @@ -2437,6 +2437,12 @@ * -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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200309150002.h8F02ZM7045982>
