+ pieceList[pc][index[lastSquare]] = lastSquare;
+ pieceList[pc][pieceCount[pc]] = SQ_NONE;
+ pieceCount[make_piece(color_of(pc), ALL_PIECES)]--;
+ psq -= PSQT::psq[pc][s];
+}
+
+inline void Position::move_piece(Piece pc, Square from, Square to) {
+
+ // index[from] is not updated and becomes stale. This works as long as index[]
+ // is accessed just by known occupied squares.
+ Bitboard fromTo = from | to;
+ byTypeBB[ALL_PIECES] ^= fromTo;
+ byTypeBB[type_of(pc)] ^= fromTo;
+ byColorBB[color_of(pc)] ^= fromTo;
+ board[from] = NO_PIECE;
+ board[to] = pc;
+ index[to] = index[from];
+ pieceList[pc][index[to]] = to;
+ psq += PSQT::psq[pc][to] - PSQT::psq[pc][from];
+}
+
+inline void Position::do_move(Move m, StateInfo& newSt) {
+ do_move(m, newSt, gives_check(m));