#include "bitcount.h"
#include "movegen.h"
+#include "notation.h"
#include "position.h"
#include "psqtab.h"
#include "rkiss.h"
sideToMove = ~sideToMove;
}
+// Position::hash_after_move() updates the hash key needed for the speculative prefetch.
+// It doesn't recognize special moves like castling, en-passant and promotions.
+Key Position::hash_after_move(Move m) const {
+
+ int from = from_sq(m);
+ int to = to_sq(m);
+ Piece p = board[from];
+ Piece capP = board[to];
+ Key ret = st->key ^ Zobrist::side;
+ if (capP != NO_PIECE)
+ ret ^= Zobrist::psq[color_of(capP)][type_of(capP)][to];
+ ret ^= Zobrist::psq[color_of(p)][type_of(p)][to];
+ ret ^= Zobrist::psq[color_of(p)][type_of(p)][from];
+ return ret;
+}
/// Position::see() is a static exchange evaluator: It tries to estimate the
/// material gain or loss resulting from a move.