mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 00:26:33 +08:00
Avoid a double copy when saving a TTEntry
In statement: *tte = TTEntry(posKey32, v, t, d, m, generation, statV, kingD); We first create a TTEntry, then we copy the temporary entry to its final destination in *tte then we discard the TTEntry. Instead of this assign the fields directly to the destination TTEntry. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -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++;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user