mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 16:46:30 +08:00
Remember when TT value equals static evaluation value
When the stored TT value equals the static value set a proper flag so to not call evaluation() if we hit the same position again but use the stored TT value instead. This is another trick to avoid calling costly evaluation() in qsearch. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -103,7 +103,7 @@ void TranspositionTable::clear() {
|
||||
/// current search and t2 is from a previous search, or if the depth of t1
|
||||
/// is bigger than the depth of t2.
|
||||
|
||||
void TranspositionTable::store(const Position &pos, Value v, Depth d,
|
||||
TTEntry* TranspositionTable::store(const Position &pos, Value v, Depth d,
|
||||
Move m, ValueType type) {
|
||||
TTEntry *tte, *replace;
|
||||
|
||||
@@ -116,7 +116,7 @@ void TranspositionTable::store(const Position &pos, Value v, Depth d,
|
||||
m = tte->move();
|
||||
|
||||
*tte = TTEntry(pos.get_key(), v, type, d, m, generation);
|
||||
return;
|
||||
return tte;
|
||||
}
|
||||
else if (i == 0) // replace would be a no-op in this common case
|
||||
continue;
|
||||
@@ -130,6 +130,7 @@ void TranspositionTable::store(const Position &pos, Value v, Depth d,
|
||||
}
|
||||
*replace = TTEntry(pos.get_key(), v, type, d, m, generation);
|
||||
writes++;
|
||||
return replace;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user