]> git.sesse.net Git - stockfish/commitdiff
Cleanup code
authorStefan Geschwentner <stgeschwentner@gmail.com>
Tue, 9 Aug 2022 18:56:13 +0000 (20:56 +0200)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Fri, 12 Aug 2022 12:29:40 +0000 (14:29 +0200)
This PR includes following cleanups:
- Remove the unused depth variable in the thread class.
- cleanup ValueList (added from mstembera)

closes https://github.com/official-stockfish/Stockfish/pull/4127

No functional change.

src/evaluate.cpp
src/misc.h
src/position.cpp
src/search.cpp
src/thread.h

index 9e3eaba512c5e1de107d9e2f438f1a0e954abd80..7d5876758c0836e5ad43e363e4dd9f5f719502aa 100644 (file)
@@ -1114,7 +1114,6 @@ std::string Eval::trace(Position& pos) {
   std::memset(scores, 0, sizeof(scores));
 
   // Reset any global variable used in eval
-  pos.this_thread()->depth           = 0;
   pos.this_thread()->trend           = SCORE_ZERO;
   pos.this_thread()->bestValue       = VALUE_ZERO;
   pos.this_thread()->optimism[WHITE] = VALUE_ZERO;
index 2fd2b408a1261644c7b0c7315f91dcb77cc2bf54..fe1143def0b35150eeedf51d3976baa46beb467e 100644 (file)
@@ -116,23 +116,10 @@ class ValueList {
 
 public:
   std::size_t size() const { return size_; }
-  void resize(std::size_t newSize) { size_ = newSize; }
   void push_back(const T& value) { values_[size_++] = value; }
-  T& operator[](std::size_t index) { return values_[index]; }
-  T* begin() { return values_; }
-  T* end() { return values_ + size_; }
-  const T& operator[](std::size_t index) const { return values_[index]; }
   const T* begin() const { return values_; }
   const T* end() const { return values_ + size_; }
 
-  void swap(ValueList& other) {
-    const std::size_t maxSize = std::max(size_, other.size_);
-    for (std::size_t i = 0; i < maxSize; ++i) {
-      std::swap(values_[i], other.values_[i]);
-    }
-    std::swap(size_, other.size_);
-  }
-
 private:
   T values_[MaxSize];
   std::size_t size_ = 0;
index ec9229ea33799e2b0234093912612d9d704d6845..08ed1a89e1578f8202392c4bbf61daa8653fcda9 100644 (file)
@@ -1099,10 +1099,12 @@ bool Position::see_ge(Move m, Value threshold) const {
       // Don't allow pinned pieces to attack as long as there are
       // pinners on their original square.
       if (pinners(~stm) & occupied)
+      {
           stmAttackers &= ~blockers_for_king(stm);
 
-      if (!stmAttackers)
-          break;
+          if (!stmAttackers)
+              break;
+      }
 
       res ^= 1;
 
index 7c0601e60e2b2f1ab2c3ce83c8d2641bc8743d1d..565fba0f89f7ece8ffccaf1aef5ea00beff5b3b6 100644 (file)
@@ -565,7 +565,6 @@ namespace {
 
     // Step 1. Initialize node
     Thread* thisThread = pos.this_thread();
-    thisThread->depth  = depth;
     ss->inCheck        = pos.checkers();
     priorCapture       = pos.captured_piece();
     Color us           = pos.side_to_move();
index 9e9cd488c3c2fa71d9c987bde2043059e4d453cc..c430a8184e6da110a5addac0bbabd57acdcb3618 100644 (file)
@@ -69,7 +69,7 @@ public:
   Position rootPos;
   StateInfo rootState;
   Search::RootMoves rootMoves;
-  Depth rootDepth, completedDepth, depth, previousDepth;
+  Depth rootDepth, completedDepth, previousDepth;
   Value rootDelta;
   CounterMoveHistory counterMoves;
   ButterflyHistory mainHistory;