mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-06 10:53:50 +08:00
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:
@@ -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)++;
|
||||
|
||||
Reference in New Issue
Block a user