src/common.js
function popcount(i) {
  i = i - ((i >> 1) & 0x55555555);
  i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
  return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
}
function popcount(i) {
  i = i - ((i >> 1) & 0x55555555);
  i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
  return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
}
function popcount ( i ) { i = i - ( ( i >> 1 ) & 0x55555555 ) ; i = ( i & 0x33333333 ) + ( ( i >> 2 ) & 0x33333333 ) ; return ( ( ( i + ( i >> 4 ) ) & 0x0F0F0F0F ) * 0x01010101 ) >> 24 ; }
Calculate Hamming weight for a given bitmap. Also known as 'population count'
operation.
@link http://stackoverflow.com/questions/109023/how-to-count-the-number-of-set-bits-in-a-32-bit-integer/109025#109025
Calculate Hamming weight for a given bitmap . Also known as population count operation .