]> git.sesse.net Git - stockfish/commitdiff
Retire redundant square_is_occupied()
authorMarco Costalba <mcostalba@gmail.com>
Tue, 28 Jun 2011 13:29:58 +0000 (15:29 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Tue, 28 Jun 2011 16:10:27 +0000 (17:10 +0100)
No functional change.

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

index 3d736b255952537f26515f97b5118116b9b1fce9..cc635b84e37160a59cf004fff974d18124397869 100644 (file)
@@ -517,12 +517,12 @@ namespace {
 
     // It is a bit complicated to correctly handle Chess960
     for (s = Min(ksq, s1); s <= Max(ksq, s1); s++)
-        if (  (s != ksq && s != rsq && pos.square_is_occupied(s))
+        if (  (s != ksq && s != rsq && !pos.square_is_empty(s))
             ||(pos.attackers_to(s) & pos.pieces_of_color(them)))
             illegal = true;
 
     for (s = Min(rsq, s2); s <= Max(rsq, s2); s++)
-        if (s != ksq && s != rsq && pos.square_is_occupied(s))
+        if (s != ksq && s != rsq && !pos.square_is_empty(s))
             illegal = true;
 
     if (   Side == QUEEN_SIDE
index c9da8d8b56e25e5df22b9610e59fde0524b3f58a..77c0647a940b33165bd4217bfe1a090b5030a3d2 100644 (file)
@@ -282,7 +282,7 @@ const string Position::to_fen() const {
       {
           sq = make_square(file, rank);
 
-          if (square_is_occupied(sq))
+          if (!square_is_empty(sq))
           {
               if (emptyCnt != '0')
               {
@@ -475,7 +475,7 @@ bool Position::move_attacks_square(Move m, Square s) const {
   Bitboard occ, xray;
   Square f = move_from(m), t = move_to(m);
 
-  assert(square_is_occupied(f));
+  assert(!square_is_empty(f));
 
   if (bit_is_set(attacks_from(piece_on(f), t), s))
       return true;
@@ -1606,7 +1606,7 @@ Key Position::compute_key() const {
   Key result = zobCastle[st->castleRights];
 
   for (Square s = SQ_A1; s <= SQ_H8; s++)
-      if (square_is_occupied(s))
+      if (!square_is_empty(s))
           result ^= zobrist[piece_color(piece_on(s))][piece_type(piece_on(s))][s];
 
   if (ep_square() != SQ_NONE)
index b30b1ffe4be16870be978dac20900351c3eace1b..244d365ba47a67d400cd62fb854886f94de9fa82 100644 (file)
@@ -130,7 +130,6 @@ public:
   // The piece on a given square
   Piece piece_on(Square s) const;
   bool square_is_empty(Square s) const;
-  bool square_is_occupied(Square s) const;
 
   // Side to move
   Color side_to_move() const;
@@ -322,10 +321,6 @@ inline bool Position::square_is_empty(Square s) const {
   return piece_on(s) == PIECE_NONE;
 }
 
-inline bool Position::square_is_occupied(Square s) const {
-  return !square_is_empty(s);
-}
-
 inline Color Position::side_to_move() const {
   return sideToMove;
 }