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

@@ -1917,7 +1917,7 @@ bool Position::is_ok(int* failedStep) const {
// Is there more than 2 checkers?
if (failedStep) (*failedStep)++;
if (debugCheckerCount && count_1s(st->checkersBB) > 2)
if (debugCheckerCount && count_1s<CNT32>(st->checkersBB) > 2)
return false;
// Bitboards OK?
@@ -1986,7 +1986,7 @@ bool Position::is_ok(int* failedStep) const {
if (debugPieceCounts)
for (Color c = WHITE; c <= BLACK; c++)
for (PieceType pt = PAWN; pt <= KING; pt++)
if (pieceCount[c][pt] != count_1s(pieces(pt, c)))
if (pieceCount[c][pt] != count_1s<CNT32>(pieces(pt, c)))
return false;
if (failedStep) (*failedStep)++;