]> git.sesse.net Git - stockfish/commitdiff
Retire kingSquare[] array
authorMarco Costalba <mcostalba@gmail.com>
Wed, 23 Sep 2009 16:47:03 +0000 (17:47 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Wed, 23 Sep 2009 16:47:03 +0000 (17:47 +0100)
It is redundant. Use pieceList[c][KING][0] instead.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/position.cpp
src/position.h

index 1725acbb4bc76ef68cb91249b76e0d9fa9beec98..e759b64242734a66ba22ad078065751f05e91609 100644 (file)
@@ -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;
 }
 
 
index 4f6f2d5383b72c861e56db32e27a22110e37014e..88ee8fe233f4c50f5d0eef96facb15055946a689 100644 (file)
@@ -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 {