Rewrite bit counting functions

Get rid of macros and use templates instead,
this is safer and allows us fix the warning:

ISO C++ forbids braced-groups within expressions

That broke compilation with -pedantic flag under
gcc and POPCNT enabled.

No functional and no performance change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2010-10-04 11:45:04 +02:00
parent 3249777cdb
commit d4876dc963
8 changed files with 66 additions and 69 deletions

View File

@@ -404,7 +404,7 @@ namespace {
}
for (Bitboard b = 0ULL; b < 256ULL; b++)
BitCount8Bit[b] = (uint8_t)count_1s(b);
BitCount8Bit[b] = (uint8_t)count_1s<CNT32>(b);
}
int remove_bit_8(int i) { return ((i & ~15) >> 1) | (i & 7); }
@@ -494,7 +494,7 @@ namespace {
Bitboard index_to_bitboard(int index, Bitboard mask) {
Bitboard result = 0ULL;
int bits = count_1s(mask);
int bits = count_1s<CNT32>(mask);
for (int i = 0; i < bits; i++)
{