Functions |
|
static int | popCount (uint32_t v) |
static int awUtil::bitfield::popCount | ( | uint32_t | v | ) | [inline, static] |
{ // for 32-bit unsigned ints that we use here, the following // bit-hack will extract the number of bits set in place. // see: graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel // or google "bit counting" or "popcount" v = v - ((v >> 1) & 0x55555555); v = (v & 0x33333333) + ((v >> 2) & 0x33333333); return ((v + (v >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; }