Use CheckInfo to store pinned bitboard

This trivial change gives an impressive 2,5% speedup !!!!

Also retire one unused move_gives_check() overload.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2011-06-20 09:46:31 +02:00
parent 7ea38e980b
commit 018022b866
3 changed files with 13 additions and 20 deletions
+5 -9
View File
@@ -90,13 +90,14 @@ CheckInfo::CheckInfo(const Position& pos) {
ksq = pos.king_square(them);
dcCandidates = pos.discovered_check_candidates(us);
pinned = pos.pinned_pieces(us);
checkSq[PAWN] = pos.attacks_from<PAWN>(ksq, them);
checkSq[PAWN] = pos.attacks_from<PAWN>(ksq, them);
checkSq[KNIGHT] = pos.attacks_from<KNIGHT>(ksq);
checkSq[BISHOP] = pos.attacks_from<BISHOP>(ksq);
checkSq[ROOK] = pos.attacks_from<ROOK>(ksq);
checkSq[QUEEN] = checkSq[BISHOP] | checkSq[ROOK];
checkSq[KING] = EmptyBoardBB;
checkSq[ROOK] = pos.attacks_from<ROOK>(ksq);
checkSq[QUEEN] = checkSq[BISHOP] | checkSq[ROOK];
checkSq[KING] = EmptyBoardBB;
}
@@ -746,11 +747,6 @@ bool Position::move_is_pl(const Move m) const {
/// Position::move_gives_check() tests whether a pseudo-legal move is a check
bool Position::move_gives_check(Move m) const {
return move_gives_check(m, CheckInfo(*this));
}
bool Position::move_gives_check(Move m, const CheckInfo& ci) const {
assert(is_ok());