assert(&newSt != st);
nodes++;
- Key key = st->key;
+ Key k = st->key;
// Copy some fields of old state to our new StateInfo object except the ones
// which are recalculated from scratch anyway, then switch our state pointer
st = &newSt;
// Update side to move
- key ^= zobSideToMove;
+ k ^= zobSideToMove;
// Increment the 50 moves rule draw counter. Resetting it to zero in the
// case of non-reversible moves is taken care of later.
if (is_castle(m))
{
- st->key = key;
+ st->key = k;
do_castle_move<true>(m);
return;
}
pieceList[them][capture][pieceCount[them][capture]] = SQ_NONE;
// Update hash keys
- key ^= zobrist[them][capture][capsq];
+ k ^= zobrist[them][capture][capsq];
st->materialKey ^= zobrist[them][capture][pieceCount[them][capture]];
// Update incremental scores
}
// Update hash key
- key ^= zobrist[us][pt][from] ^ zobrist[us][pt][to];
+ k ^= zobrist[us][pt][from] ^ zobrist[us][pt][to];
// Reset en passant square
if (st->epSquare != SQ_NONE)
{
- key ^= zobEp[st->epSquare];
+ k ^= zobEp[st->epSquare];
st->epSquare = SQ_NONE;
}
if ( st->castleRights != CASTLES_NONE
&& (castleRightsMask[from] & castleRightsMask[to]) != ALL_CASTLES)
{
- key ^= zobCastle[st->castleRights];
+ k ^= zobCastle[st->castleRights];
st->castleRights &= castleRightsMask[from] & castleRightsMask[to];
- key ^= zobCastle[st->castleRights];
+ k ^= zobCastle[st->castleRights];
}
// Prefetch TT access as soon as we know key is updated
- prefetch((char*)TT.first_entry(key));
+ prefetch((char*)TT.first_entry(k));
// Move the piece
Bitboard move_bb = make_move_bb(from, to);
&& (attacks_from<PAWN>(from + pawn_push(us), us) & pieces(PAWN, them)))
{
st->epSquare = Square((from + to) / 2);
- key ^= zobEp[st->epSquare];
+ k ^= zobEp[st->epSquare];
}
if (is_promotion(m))
pieceList[us][promotion][index[to]] = to;
// Update hash keys
- key ^= zobrist[us][PAWN][to] ^ zobrist[us][promotion][to];
+ k ^= zobrist[us][PAWN][to] ^ zobrist[us][promotion][to];
st->pawnKey ^= zobrist[us][PAWN][to];
st->materialKey ^= zobrist[us][promotion][pieceCount[us][promotion]++]
^ zobrist[us][PAWN][pieceCount[us][PAWN]];
st->capturedType = capture;
// Update the key with the final value
- st->key = key;
+ st->key = k;
// Update checkers bitboard, piece must be already moved
st->checkersBB = 0;