mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-21 17:46:26 +08:00
Refresh TT entries generation automatically on probe
And other assorted simplifications, tested with SPRT[-3, 1] Passed both short TC LLR: 2.96 (-2.94,2.94) [-3.00,1.00] Total: 18814 W: 3600 L: 3475 D: 11739 And long TC LLR: 2.96 (-2.94,2.94) [-3.00,1.00] Total: 20731 W: 3217 L: 3096 D: 14418 No functional change.
This commit is contained in:
committed by
Marco Costalba
parent
f12449d492
commit
ffdf63ff7c
15
src/tt.cpp
15
src/tt.cpp
@@ -70,12 +70,15 @@ void TranspositionTable::clear() {
|
||||
|
||||
const TTEntry* TranspositionTable::probe(const Key key) const {
|
||||
|
||||
const TTEntry* tte = first_entry(key);
|
||||
TTEntry* tte = first_entry(key);
|
||||
uint32_t key32 = key >> 32;
|
||||
|
||||
for (unsigned i = 0; i < ClusterSize; ++i, ++tte)
|
||||
if (tte->key() == key32)
|
||||
if (tte->key32 == key32)
|
||||
{
|
||||
tte->generation8 = generation; // Refresh
|
||||
return tte;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -99,7 +102,7 @@ void TranspositionTable::store(const Key key, Value v, Bound b, Depth d, Move m,
|
||||
|
||||
for (unsigned i = 0; i < ClusterSize; ++i, ++tte)
|
||||
{
|
||||
if (!tte->key() || tte->key() == key32) // Empty or overwrite old
|
||||
if (!tte->key32 || tte->key32 == key32) // Empty or overwrite old
|
||||
{
|
||||
if (!m)
|
||||
m = tte->move(); // Preserve any existing ttMove
|
||||
@@ -109,9 +112,9 @@ void TranspositionTable::store(const Key key, Value v, Bound b, Depth d, Move m,
|
||||
}
|
||||
|
||||
// Implement replace strategy
|
||||
c1 = (replace->generation() == generation ? 2 : 0);
|
||||
c2 = (tte->generation() == generation || tte->bound() == BOUND_EXACT ? -2 : 0);
|
||||
c3 = (tte->depth() < replace->depth() ? 1 : 0);
|
||||
c1 = (replace->generation8 == generation ? 2 : 0);
|
||||
c2 = (tte->generation8 == generation || tte->bound() == BOUND_EXACT ? -2 : 0);
|
||||
c3 = (tte->depth16 < replace->depth16 ? 1 : 0);
|
||||
|
||||
if (c1 + c2 + c3 > 0)
|
||||
replace = tte;
|
||||
|
||||
Reference in New Issue
Block a user