]> git.sesse.net Git - stockfish/commitdiff
TranspositionTable: early skip on an empty TT entry
authorMarco Costalba <mcostalba@gmail.com>
Sat, 6 Sep 2008 10:20:28 +0000 (12:20 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 6 Sep 2008 10:20:28 +0000 (12:20 +0200)
Instead of going for the whole 4 cycle loop early
skip if TT entry is empty.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/tt.cpp

index 146e591f4462f5cb612b9a7e18d6dec190f8c5c6..66166ce9c348f27a410ec8b7fb8eb59e9b885453 100644 (file)
@@ -108,6 +108,12 @@ void TranspositionTable::store(const Position &pos, Value v, Depth d,
   tte = replace = entries + int(pos.get_key() & (size - 1)) * 4;
   for (int i = 0; i < 4; i++)
   {
+    if (!(tte+i)->key()) // still empty
+    {
+        *(tte+i) = TTEntry(pos.get_key(), v, type, d, m, generation);
+        writes++;
+        return;
+    }
     if ((tte+i)->key() == pos.get_key())
     {
         if (m == MOVE_NONE)