mirror of
https://github.com/sockspls/badfish
synced 2025-05-01 09:13:08 +00:00
Remove unnecessary assignments related to adjusted static evaluation
In both search and qsearch, there are instances where we do unadjustedStaticEval = ss->staticEval = eval/bestValue = tte->eval(), but immediately after re-assign ss-static and eval/bestValue to some new value, which makes the initial assignment redundant. closes https://github.com/official-stockfish/Stockfish/pull/5045 No functional change
This commit is contained in:
parent
21dff6c276
commit
3d5b16df7c
1 changed files with 11 additions and 11 deletions
|
@ -701,9 +701,9 @@ Value Search::Worker::search(
|
||||||
else if (ss->ttHit)
|
else if (ss->ttHit)
|
||||||
{
|
{
|
||||||
// Never assume anything about values stored in TT
|
// Never assume anything about values stored in TT
|
||||||
unadjustedStaticEval = ss->staticEval = eval = tte->eval();
|
unadjustedStaticEval = tte->eval();
|
||||||
if (eval == VALUE_NONE)
|
if (unadjustedStaticEval == VALUE_NONE)
|
||||||
unadjustedStaticEval = ss->staticEval = eval = evaluate(pos, thisThread->optimism[us]);
|
unadjustedStaticEval = evaluate(pos, thisThread->optimism[us]);
|
||||||
else if (PvNode)
|
else if (PvNode)
|
||||||
Eval::NNUE::hint_common_parent_position(pos);
|
Eval::NNUE::hint_common_parent_position(pos);
|
||||||
|
|
||||||
|
@ -715,7 +715,7 @@ Value Search::Worker::search(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unadjustedStaticEval = ss->staticEval = eval = evaluate(pos, thisThread->optimism[us]);
|
unadjustedStaticEval = evaluate(pos, thisThread->optimism[us]);
|
||||||
ss->staticEval = eval = to_corrected_static_eval(unadjustedStaticEval, *thisThread, pos);
|
ss->staticEval = eval = to_corrected_static_eval(unadjustedStaticEval, *thisThread, pos);
|
||||||
|
|
||||||
// Static evaluation is saved as it was before adjustment by correction history
|
// Static evaluation is saved as it was before adjustment by correction history
|
||||||
|
@ -1434,9 +1434,9 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta,
|
||||||
if (ss->ttHit)
|
if (ss->ttHit)
|
||||||
{
|
{
|
||||||
// Never assume anything about values stored in TT
|
// Never assume anything about values stored in TT
|
||||||
if ((unadjustedStaticEval = ss->staticEval = bestValue = tte->eval()) == VALUE_NONE)
|
unadjustedStaticEval = tte->eval();
|
||||||
unadjustedStaticEval = ss->staticEval = bestValue =
|
if (unadjustedStaticEval == VALUE_NONE)
|
||||||
evaluate(pos, thisThread->optimism[us]);
|
unadjustedStaticEval = evaluate(pos, thisThread->optimism[us]);
|
||||||
ss->staticEval = bestValue =
|
ss->staticEval = bestValue =
|
||||||
to_corrected_static_eval(unadjustedStaticEval, *thisThread, pos);
|
to_corrected_static_eval(unadjustedStaticEval, *thisThread, pos);
|
||||||
|
|
||||||
|
@ -1448,8 +1448,8 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// In case of null move search, use previous static eval with a different sign
|
// In case of null move search, use previous static eval with a different sign
|
||||||
unadjustedStaticEval = ss->staticEval = bestValue =
|
unadjustedStaticEval = (ss - 1)->currentMove != Move::null()
|
||||||
(ss - 1)->currentMove != Move::null() ? evaluate(pos, thisThread->optimism[us])
|
? evaluate(pos, thisThread->optimism[us])
|
||||||
: -(ss - 1)->staticEval;
|
: -(ss - 1)->staticEval;
|
||||||
ss->staticEval = bestValue =
|
ss->staticEval = bestValue =
|
||||||
to_corrected_static_eval(unadjustedStaticEval, *thisThread, pos);
|
to_corrected_static_eval(unadjustedStaticEval, *thisThread, pos);
|
||||||
|
|
Loading…
Add table
Reference in a new issue