From dcb323bf0dda6277dad18513060cdf78cece47f2 Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Wed, 23 Sep 2009 17:47:03 +0100 Subject: [PATCH] Retire kingSquare[] array It is redundant. Use pieceList[c][KING][0] instead. No functional change. Signed-off-by: Marco Costalba --- src/position.cpp | 12 +----------- src/position.h | 4 ++-- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/position.cpp b/src/position.cpp index 1725acbb..e759b642 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -704,7 +704,7 @@ void Position::do_move(Move m, StateInfo& newSt, Bitboard dcCandidates) { struct ReducedStateInfo { Key key, pawnKey, materialKey; int castleRights, rule50; - Square kingSquare[2], epSquare; + Square epSquare; Value mgValue, egValue; Value npMaterial[2]; }; @@ -784,10 +784,6 @@ void Position::do_move(Move m, StateInfo& newSt, Bitboard dcCandidates) { board[to] = board[from]; board[from] = EMPTY; - // If the moving piece was a king, update the king square - if (pt == KING) - st->kingSquare[us] = to; - // Update piece lists, note that index[from] is not updated and // becomes stale. This works as long as index[] is accessed just // by known occupied squares. @@ -1005,9 +1001,6 @@ void Position::do_castle_move(Move m) { board[kto] = king; board[rto] = rook; - // Update king square - st->kingSquare[us] = kto; - // Update piece lists pieceList[us][KING][index[kfrom]] = kto; pieceList[us][ROOK][index[rfrom]] = rto; @@ -1519,9 +1512,6 @@ void Position::put_piece(Piece p, Square s) { set_bit(&byTypeBB[0], s); // HACK: byTypeBB[0] contains all occupied squares. pieceCount[c][pt]++; - - if (pt == KING) - st->kingSquare[c] = s; } diff --git a/src/position.h b/src/position.h index 4f6f2d53..88ee8fe2 100644 --- a/src/position.h +++ b/src/position.h @@ -89,7 +89,7 @@ enum Phase { struct StateInfo { Key key, pawnKey, materialKey; int castleRights, rule50; - Square kingSquare[2], epSquare; + Square epSquare; Value mgValue, egValue; Value npMaterial[2]; @@ -408,7 +408,7 @@ inline Square Position::ep_square() const { } inline Square Position::king_square(Color c) const { - return st->kingSquare[c]; + return pieceList[c][KING][0]; } inline bool Position::can_castle_kingside(Color side) const { -- 2.39.2