-/// count_1s() counts the number of nonzero bits in a bitboard.
-/// We have different optimized versions according if platform
-/// is 32 or 64 bits, and to the maximum number of nonzero bits.
-/// We also support hardware popcnt instruction. See Readme.txt
-/// on how to pgo compile with popcnt support.
-template<BitCountType> inline int count_1s(Bitboard);
+/// Determine at compile time the best popcount<> specialization according if
+/// platform is 32 or 64 bits, to the maximum number of nonzero bits to count or
+/// use hardware popcnt instruction when available.
+const BitCountType Full = HasPopCnt ? CNT_HW_POPCNT : Is64Bit ? CNT_64 : CNT_32;
+const BitCountType Max15 = HasPopCnt ? CNT_HW_POPCNT : Is64Bit ? CNT_64_MAX15 : CNT_32_MAX15;
+
+
+/// popcount() counts the number of nonzero bits in a bitboard
+template<BitCountType> inline int popcount(Bitboard);