Skip to content

Commit 865b713

Browse files
committed
Simplify TT replace strategy
Tested for no-regression with SPRT[-3, 1] at STC LLR: 2.96 (-2.94,2.94) [-3.00,1.00] Total: 32046 W: 6020 L: 5918 D: 20108 No functional change.
1 parent e7362da commit 865b713

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/tt.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ const TTEntry* TranspositionTable::probe(const Key key) const {
9494

9595
void TranspositionTable::store(const Key key, Value v, Bound b, Depth d, Move m, Value statV) {
9696

97-
int c1, c2, c3;
9897
TTEntry *tte, *replace;
9998
uint32_t key32 = key >> 32; // Use the high 32 bits as key inside the cluster
10099

@@ -112,11 +111,9 @@ void TranspositionTable::store(const Key key, Value v, Bound b, Depth d, Move m,
112111
}
113112

114113
// Implement replace strategy
115-
c1 = (replace->generation8 == generation ? 2 : 0);
116-
c2 = (tte->generation8 == generation || tte->bound() == BOUND_EXACT ? -2 : 0);
117-
c3 = (tte->depth16 < replace->depth16 ? 1 : 0);
118-
119-
if (c1 + c2 + c3 > 0)
114+
if ( (replace->generation8 == generation) * 2
115+
- (tte->generation8 == generation || tte->bound() == BOUND_EXACT) * 2
116+
+ (tte->depth16 < replace->depth16) > 0)
120117
replace = tte;
121118
}
122119

0 commit comments

Comments
 (0)