Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed unnecessary assignments. #5045

Closed
Closed
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,9 +701,9 @@ Value Search::Worker::search(
else if (ss->ttHit)
{
// Never assume anything about values stored in TT
unadjustedStaticEval = ss->staticEval = eval = tte->eval();
if (eval == VALUE_NONE)
unadjustedStaticEval = ss->staticEval = eval = evaluate(pos, thisThread->optimism[us]);
unadjustedStaticEval = tte->eval();
if (unadjustedStaticEval == VALUE_NONE)
unadjustedStaticEval = evaluate(pos, thisThread->optimism[us]);
else if (PvNode)
Eval::NNUE::hint_common_parent_position(pos);

Expand All @@ -715,7 +715,7 @@ Value Search::Worker::search(
}
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);

// Static evaluation is saved as it was before adjustment by correction history
Expand Down Expand Up @@ -1434,9 +1434,8 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta,
if (ss->ttHit)
{
// Never assume anything about values stored in TT
if ((unadjustedStaticEval = ss->staticEval = bestValue = tte->eval()) == VALUE_NONE)
unadjustedStaticEval = ss->staticEval = bestValue =
evaluate(pos, thisThread->optimism[us]);
if ((unadjustedStaticEval = tte->eval()) == VALUE_NONE)
Disservin marked this conversation as resolved.
Show resolved Hide resolved
unadjustedStaticEval = evaluate(pos, thisThread->optimism[us]);
ss->staticEval = bestValue =
to_corrected_static_eval(unadjustedStaticEval, *thisThread, pos);

Expand All @@ -1448,10 +1447,10 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta,
else
{
// In case of null move search, use previous static eval with a different sign
unadjustedStaticEval = ss->staticEval = bestValue =
(ss - 1)->currentMove != Move::null() ? evaluate(pos, thisThread->optimism[us])
: -(ss - 1)->staticEval;
ss->staticEval = bestValue =
unadjustedStaticEval = (ss - 1)->currentMove != Move::null()
? evaluate(pos, thisThread->optimism[us])
: -(ss - 1)->staticEval;
ss->staticEval = bestValue =
to_corrected_static_eval(unadjustedStaticEval, *thisThread, pos);
}

Expand Down
Loading