Go to the source code of this file.
Functions | |
int | countbits (unsigned word) |
int countbits | ( | unsigned | word | ) | [inline] |
Definition at line 5 of file countBits.h.
References genRecEmupikp::i.
Referenced by MdcSegPatterns::MdcSegPatterns(), and MdcSegFinder::tryPatterns().
00005 { 00006 const int nbit[16] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 }; 00007 int nset=0; 00008 for (unsigned i=0;i<2*sizeof(unsigned);i++) { // assume char = 8 bits, i.e. two 00009 nset+=nbit[word&0xf]; // iterations per 'char' size object 00010 word>>=4; 00011 } 00012 return nset; 00013 }