X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fposition.cpp;h=8c6dc8023af52997b2dac142c5fcb454a07ed314;hb=4e72e2a964754611de85536c13ae069f85839b85;hp=84892d094a60fd3d770b1af0ba2546724ef7b8a9;hpb=82ad9ce9cfb0eff33f1d781f329f7c5dc0b277eb;p=stockfish diff --git a/src/position.cpp b/src/position.cpp index 84892d09..8c6dc802 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -18,6 +18,7 @@ along with this program. If not, see . */ +#include #include #include // For offsetof() #include // For std::memset, std::memcmp @@ -340,13 +341,8 @@ void Position::set_castling_right(Color c, Square rfrom) { Square kto = relative_square(c, cs == KING_SIDE ? SQ_G1 : SQ_C1); Square rto = relative_square(c, cs == KING_SIDE ? SQ_F1 : SQ_D1); - for (Square s = std::min(rfrom, rto); s <= std::max(rfrom, rto); ++s) - if (s != kfrom && s != rfrom) - castlingPath[cr] |= s; - - for (Square s = std::min(kfrom, kto); s <= std::max(kfrom, kto); ++s) - if (s != kfrom && s != rfrom) - castlingPath[cr] |= s; + castlingPath[cr] = (between_bb(rfrom, rto) | between_bb(kfrom, kto) | rto | kto) + & ~(square_bb(kfrom) | rfrom); } @@ -864,7 +860,6 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) { // Update pawn hash key and prefetch access to pawnsTable st->pawnKey ^= Zobrist::psq[pc][from] ^ Zobrist::psq[pc][to]; - prefetch2(thisThread->pawnsTable[st->pawnKey]); // Reset rule 50 draw counter st->rule50 = 0;