-replaced population count by a more generic version that should be immune to differences between
 32 and 64 bit architectures