From: protonspring Date: Sun, 20 Jan 2019 11:21:16 +0000 (-0700) Subject: Clean-up some shifting in space calculation (#1955) X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=691a287bfe7a2afbfa1d2b3129f4a089b188b6e4 Clean-up some shifting in space calculation (#1955) No functional change. --- diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 17c52e18..5b914d87 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -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); @@ -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(behind); + behind |= shift(shift(behind)); int bonus = popcount(safe) + popcount(behind & safe); int weight = pos.count(Us)