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:
Marco Costalba
2010-06-05 11:50:24 +02:00
parent 287b46aa63
commit ed2754227a
2 changed files with 23 additions and 20 deletions

View 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++;
}