Skip to content

Commit

Permalink
Clean-up some shifting in space calculation (official-stockfish#1955)
Browse files Browse the repository at this point in the history
No functional change.
  • Loading branch information
protonspring authored and mcostalba committed Jan 20, 2019
1 parent 3acacf8 commit 691a287
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/evaluate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,8 @@ namespace {
if (pos.non_pawn_material() < SpaceThreshold)
return SCORE_ZERO;

constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
constexpr Direction Down = (Us == WHITE ? SOUTH : NORTH);
constexpr Bitboard SpaceMask =
Us == WHITE ? CenterFiles & (Rank2BB | Rank3BB | Rank4BB)
: CenterFiles & (Rank7BB | Rank6BB | Rank5BB);
Expand All @@ -713,8 +714,8 @@ namespace {

// Find all squares which are at most three squares behind some friendly pawn
Bitboard behind = pos.pieces(Us, PAWN);
behind |= (Us == WHITE ? behind >> 8 : behind << 8);
behind |= (Us == WHITE ? behind >> 16 : behind << 16);
behind |= shift<Down>(behind);
behind |= shift<Down>(shift<Down>(behind));

int bonus = popcount(safe) + popcount(behind & safe);
int weight = pos.count<ALL_PIECES>(Us)
Expand Down

0 comments on commit 691a287

Please sign in to comment.