Skip to content

Commit

Permalink
Code clean-up
Browse files Browse the repository at this point in the history
This patch implements some idea by Alain Savard and Mike Whiteley taken from the perpertual renaming/reformatting thread.

This is a pure code cleaning patch (so no change in functionality), but I use it as a pretext to correct the bogus bench number that I introduced in the previous commit.

Bench: 4413383
  • Loading branch information
snicolet committed Jul 25, 2018
1 parent c4c2e08 commit ae98927
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/evaluate.cpp
Expand Up @@ -551,7 +551,6 @@ namespace {
score += ThreatByRank * (int)relative_rank(Them, s);
}

// Bonus for king attacks on pawns or pieces which are not pawn-defended
if (weak & attackedBy[Us][KING])
score += ThreatByKing;

Expand All @@ -576,7 +575,7 @@ namespace {
b = shift<Up>(pos.pieces(Us, PAWN)) & ~pos.pieces();
b |= shift<Up>(b & TRank3BB) & ~pos.pieces();

// Keep only the squares which are not completely unsafe
// Keep only the squares which are relatively safe
b &= ~attackedBy[Them][PAWN]
& (attackedBy[Us][ALL_PIECES] | ~attackedBy[Them][ALL_PIECES]);

Expand Down
6 changes: 3 additions & 3 deletions src/misc.cpp
Expand Up @@ -224,11 +224,11 @@ void bindThisThread(size_t) {}

#else

/// get_group() retrieves logical processor information using Windows specific
/// best_group() retrieves logical processor information using Windows specific
/// API and returns the best group id for the thread with index idx. Original
/// code from Texel by Peter Österlund.

int get_group(size_t idx) {
int best_group(size_t idx) {

int threads = 0;
int nodes = 0;
Expand Down Expand Up @@ -299,7 +299,7 @@ int get_group(size_t idx) {
void bindThisThread(size_t idx) {

// Use only local variables to be thread-safe
int group = get_group(idx);
int group = best_group(idx);

if (group == -1)
return;
Expand Down

0 comments on commit ae98927

Please sign in to comment.