X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=0ed2fff4db4007737aeab8216ebc4a51e87d350f;hp=a0d5730c4e75a427da26930aeed3df681d6e1f49;hb=158014b39d69eaaf791d4913b98ffde5c4d7a874;hpb=8367cf15da0bd8bb2cd7cc51ab4404ef6842be79 diff --git a/src/position.cpp b/src/position.cpp index a0d5730c..0ed2fff4 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -561,7 +561,7 @@ bool Position::is_pseudo_legal(const Move m) const { return false; // The destination square cannot be occupied by a friendly piece - if (color_of(piece_on(to)) == us) + if (piece_on(to) != NO_PIECE && color_of(piece_on(to)) == us) return false; // Handle the special case of a pawn move @@ -587,7 +587,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 (color_of(piece_on(to)) != them) + if (piece_on(to) == NO_PIECE || color_of(piece_on(to)) != them) return false; // From and to files must be one file apart, avoids a7h5 @@ -772,7 +772,7 @@ void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveI PieceType capture = type_of(m) == ENPASSANT ? PAWN : type_of(piece_on(to)); assert(color_of(piece) == us); - assert(color_of(piece_on(to)) != us); + assert(piece_on(to) == NO_PIECE || color_of(piece_on(to)) == them); assert(capture != KING); if (capture) @@ -918,8 +918,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);