Use more_than_one() instead of single_bit()

It is more correct given what the function does. In
particular single_bit() returns true also in case of
empty bitboards.

Of course also the usual renaming while there :-)

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2012-04-14 09:16:34 +01:00
parent 25a9b601b2
commit f59323b56a
8 changed files with 67 additions and 68 deletions

View File

@@ -364,9 +364,9 @@ Bitboard Position::hidden_checkers() const {
while (pinners)
{
b = squares_between(ksq, pop_1st_bit(&pinners)) & pieces();
b = between_bb(ksq, pop_1st_bit(&pinners)) & pieces();
if (b && single_bit(b) && (b & pieces(sideToMove)))
if (b && !more_than_one(b) && (b & pieces(sideToMove)))
result |= b;
}
return result;
@@ -608,7 +608,7 @@ bool Position::is_pseudo_legal(const Move m) const {
return false;
// Our move must be a blocking evasion or a capture of the checking piece
if (!((squares_between(checksq, king_square(us)) | checkers()) & to))
if (!((between_bb(checksq, king_square(us)) | checkers()) & to))
return false;
}
// In case of king moves under check we have to remove king so to catch