From: protonspring Date: Fri, 14 Jun 2019 06:22:02 +0000 (-0600) Subject: Remove backmost_sq (#2190) X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=8cfe27b76521f3c357b8d3542717aceaa5eee23b Remove backmost_sq (#2190) This is a non-functional simplification. backmost_sq and frontmost_sq are redundant. It seems quite clear to always use frontmost_sq and use the correct color. Non functional change. --- diff --git a/src/bitboard.h b/src/bitboard.h index ef5c4fa3..7a16597d 100644 --- a/src/bitboard.h +++ b/src/bitboard.h @@ -376,10 +376,7 @@ inline Square pop_lsb(Bitboard* b) { } -/// frontmost_sq() and backmost_sq() return the most/least advanced square in -/// the given bitboard relative to the given color. - +/// frontmost_sq() returns the most advanced square for the given color inline Square frontmost_sq(Color c, Bitboard b) { return c == WHITE ? msb(b) : lsb(b); } -inline Square backmost_sq(Color c, Bitboard b) { return c == WHITE ? lsb(b) : msb(b); } #endif // #ifndef BITBOARD_H_INCLUDED diff --git a/src/endgame.cpp b/src/endgame.cpp index 4f8c2279..e10f8d5d 100644 --- a/src/endgame.cpp +++ b/src/endgame.cpp @@ -365,7 +365,7 @@ ScaleFactor Endgame::operator()(const Position& pos) const { && pos.count(weakSide) >= 1) { // Get weakSide pawn that is closest to the home rank - Square weakPawnSq = backmost_sq(weakSide, pos.pieces(weakSide, PAWN)); + Square weakPawnSq = frontmost_sq(strongSide, pos.pieces(weakSide, PAWN)); Square strongKingSq = pos.square(strongSide); Square weakKingSq = pos.square(weakSide); diff --git a/src/pawns.cpp b/src/pawns.cpp index d7848fbd..bbcadceb 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -190,7 +190,7 @@ void Entry::evaluate_shelter(const Position& pos, Square ksq, Score& shelter) { for (File f = File(center - 1); f <= File(center + 1); ++f) { b = ourPawns & file_bb(f); - Rank ourRank = b ? relative_rank(Us, backmost_sq(Us, b)) : RANK_1; + Rank ourRank = b ? relative_rank(Us, frontmost_sq(Them, b)) : RANK_1; b = theirPawns & file_bb(f); Rank theirRank = b ? relative_rank(Us, frontmost_sq(Them, b)) : RANK_1;