Skip to content

Commit 0a01dd0

Browse files
locutus2vondele
authored andcommitted
Cleanup code
This PR includes following cleanups: - Remove the unused depth variable in the thread class. - cleanup ValueList (added from mstembera) closes #4127 No functional change.
1 parent e639c45 commit 0a01dd0

File tree

5 files changed

+5
-18
lines changed

5 files changed

+5
-18
lines changed

src/evaluate.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,6 @@ std::string Eval::trace(Position& pos) {
11141114
std::memset(scores, 0, sizeof(scores));
11151115

11161116
// Reset any global variable used in eval
1117-
pos.this_thread()->depth = 0;
11181117
pos.this_thread()->trend = SCORE_ZERO;
11191118
pos.this_thread()->bestValue = VALUE_ZERO;
11201119
pos.this_thread()->optimism[WHITE] = VALUE_ZERO;

src/misc.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -116,23 +116,10 @@ class ValueList {
116116

117117
public:
118118
std::size_t size() const { return size_; }
119-
void resize(std::size_t newSize) { size_ = newSize; }
120119
void push_back(const T& value) { values_[size_++] = value; }
121-
T& operator[](std::size_t index) { return values_[index]; }
122-
T* begin() { return values_; }
123-
T* end() { return values_ + size_; }
124-
const T& operator[](std::size_t index) const { return values_[index]; }
125120
const T* begin() const { return values_; }
126121
const T* end() const { return values_ + size_; }
127122

128-
void swap(ValueList& other) {
129-
const std::size_t maxSize = std::max(size_, other.size_);
130-
for (std::size_t i = 0; i < maxSize; ++i) {
131-
std::swap(values_[i], other.values_[i]);
132-
}
133-
std::swap(size_, other.size_);
134-
}
135-
136123
private:
137124
T values_[MaxSize];
138125
std::size_t size_ = 0;

src/position.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,10 +1099,12 @@ bool Position::see_ge(Move m, Value threshold) const {
10991099
// Don't allow pinned pieces to attack as long as there are
11001100
// pinners on their original square.
11011101
if (pinners(~stm) & occupied)
1102+
{
11021103
stmAttackers &= ~blockers_for_king(stm);
11031104

1104-
if (!stmAttackers)
1105-
break;
1105+
if (!stmAttackers)
1106+
break;
1107+
}
11061108

11071109
res ^= 1;
11081110

src/search.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,6 @@ namespace {
565565

566566
// Step 1. Initialize node
567567
Thread* thisThread = pos.this_thread();
568-
thisThread->depth = depth;
569568
ss->inCheck = pos.checkers();
570569
priorCapture = pos.captured_piece();
571570
Color us = pos.side_to_move();

src/thread.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class Thread {
6969
Position rootPos;
7070
StateInfo rootState;
7171
Search::RootMoves rootMoves;
72-
Depth rootDepth, completedDepth, depth, previousDepth;
72+
Depth rootDepth, completedDepth, previousDepth;
7373
Value rootDelta;
7474
CounterMoveHistory counterMoves;
7575
ButterflyHistory mainHistory;

0 commit comments

Comments
 (0)