]> git.sesse.net Git - stockfish/commitdiff
Remove backmost_sq (#2190)
authorprotonspring <mike@whiteley.org>
Fri, 14 Jun 2019 06:22:02 +0000 (00:22 -0600)
committerMarco Costalba <mcostalba@users.noreply.github.com>
Fri, 14 Jun 2019 06:22:02 +0000 (08:22 +0200)
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.

src/bitboard.h
src/endgame.cpp
src/pawns.cpp

index ef5c4fa304ab1beb366077a36720dab9782744d4..7a16597d200e9467cb98e642e23699b7acb878bc 100644 (file)
@@ -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
index 4f8c22795b4d50b5cfb0f00b71153256a476a9d6..e10f8d5da975646d236468f6dc251f0052df60bb 100644 (file)
@@ -365,7 +365,7 @@ ScaleFactor Endgame<KBPsK>::operator()(const Position& pos) const {
       && pos.count<PAWN>(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<KING>(strongSide);
       Square weakKingSq = pos.square<KING>(weakSide);
index d7848fbd2f33364cc63232c11646701dc47f1a5a..bbcadceb3bed6a5d4c4944cc2e50b3bb0aa41a8e 100644 (file)
@@ -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;