Use the GCC built-in for PopulationCount when it's available, and use a faster