17 Dec
2003
17 Dec
'03
11:17 p.m.
From: Ian Farquhar <ifarqhar@laurel.ocs.mq.edu.au> Date: Thu, 7 Jul 1994 12:57:54 +1000 (EST)
Why bother when you can simply do an eight line function? ~~~~~ int bitcount(char b) { register int retval=0;
if (a & 1) retval++; if (a & 2) retval++; etc. return retval; }
Because on a lot of architectures this implementation may be hideously inefficient. All the world is not an Intel chip, thank god.
Not to mention it's only good for 8-bit words. In my case I am working with 16-bit data. tw