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

Conversation

GoldenRare
Copy link
Contributor

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. Change is to just remove the initial assignment to ss-staticEval and eval/bestValue. One consideration, although very minor is to use the ternary operator to immediately assign unadjustedStaticEval but unsure if there is a significant performance difference between that and an if block. Also when I ran 'make format', it suggested ss-staticEval some alignment whitespace to the above line = bestValue =, but I think looks worse than just ss-staticEval = bestValue = (line 1453).

Copy link
Member

@Disservin Disservin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good logical cleanup thanks

src/search.cpp Outdated Show resolved Hide resolved
Copy link
Member

@Disservin Disservin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw if you really don't like the alignment of 1453, you can just add a line between the two and reformat..

@GoldenRare
Copy link
Contributor Author

btw if you really don't like the alignment of 1453, you can just add a line between the two and reformat..

I'm fine with the change as long as its compliant with the existing code style. According to .clang-format this is, but at first visual glance I was unsure.

@Disservin Disservin closed this in 3d5b16d Feb 11, 2024
Viren6 pushed a commit to Viren6/Stockfish that referenced this pull request Feb 12, 2024
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 official-stockfish#5045

No functional change
Viren6 pushed a commit to Viren6/Stockfish that referenced this pull request Feb 12, 2024
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 official-stockfish#5045

No functional change
TierynnB pushed a commit to TierynnB/Stockfish that referenced this pull request Feb 14, 2024
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 official-stockfish#5045

No functional change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants