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:
Marco Costalba
2009-03-30 08:54:09 +01:00
parent c6c4713ab2
commit 6a8e46d53e
3 changed files with 22 additions and 7 deletions

View File

@@ -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;
}