X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=045b10cab7c276b8fc3806a09c4751c33fdf2523;hp=37b5c049cadd2152b6fdccaee44a87d0f57df315;hb=423c6d8a8a36fcc56d421caf0bbc12f53ba62c30;hpb=9edc7d6958fd616daecb0ab9ae2aa92042b3d34a diff --git a/src/position.cpp b/src/position.cpp index 37b5c049..045b10ca 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -542,7 +542,6 @@ bool Position::move_is_legal(const Move m) const { bool Position::is_pseudo_legal(const Move m) const { Color us = sideToMove; - Color them = ~sideToMove; Square from = from_sq(m); Square to = to_sq(m); Piece pc = piece_moved(m); @@ -587,7 +586,7 @@ bool Position::is_pseudo_legal(const Move m) const { case DELTA_SE: // Capture. The destination square must be occupied by an enemy // piece (en passant captures was handled earlier). - if (piece_on(to) == NO_PIECE || color_of(piece_on(to)) != them) + if (piece_on(to) == NO_PIECE || color_of(piece_on(to)) != ~us) return false; // From and to files must be one file apart, avoids a7h5 @@ -636,14 +635,12 @@ bool Position::is_pseudo_legal(const Move m) const { { if (type_of(pc) != KING) { - Bitboard b = checkers(); - Square checksq = pop_lsb(&b); - - if (b) // double check ? In this case a king move is required + // Double check? In this case a king move is required + if (more_than_one(checkers())) return false; // Our move must be a blocking evasion or a capture of the checking piece - if (!((between_bb(checksq, king_square(us)) | checkers()) & to)) + if (!((between_bb(lsb(checkers()), king_square(us)) | checkers()) & to)) return false; } // In case of king moves under check we have to remove king so to catch @@ -918,8 +915,8 @@ void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveI } // Prefetch pawn and material hash tables - prefetch((char*)thisThread->pawnTable.entries[st->pawnKey]); - prefetch((char*)thisThread->materialTable.entries[st->materialKey]); + prefetch((char*)thisThread->pawnsTable[st->pawnKey]); + prefetch((char*)thisThread->materialTable[st->materialKey]); // Update incremental scores st->psqScore += psq_delta(piece, from, to);