]> git.sesse.net Git - stockfish/blobdiff - src/tt.cpp
Avoid a double copy when saving a TTEntry
[stockfish] / src / tt.cpp
index 16331b8762ae04c60689a341f46af7c3ad49e9c9..501d016fd70461995a1554852dd8c70766ec52a9 100644 (file)
@@ -125,7 +125,7 @@ void TranspositionTable::store(const Key posKey, Value v, ValueType t, Depth d,
           if (m == MOVE_NONE)
               m = tte->move();
 
-          *tte = TTEntry(posKey32, v, t, d, m, generation, statV, kingD);
+          tte->save(posKey32, v, t, d, m, generation, statV, kingD);
           return;
       }
       else if (i == 0)  // replace would be a no-op in this common case
@@ -138,7 +138,7 @@ void TranspositionTable::store(const Key posKey, Value v, ValueType t, Depth d,
       if (c1 + c2 + c3 > 0)
           replace = tte;
   }
-  *replace = TTEntry(posKey32, v, t, d, m, generation, statV, kingD);
+  replace->save(posKey32, v, t, d, m, generation, statV, kingD);
   writes++;
 }