]> git.sesse.net Git - stockfish/commitdiff
simplified forward ranks.
authorprotonspring <mike@whiteley.org>
Sat, 21 Jul 2018 06:17:27 +0000 (00:17 -0600)
committerStéphane Nicolet <cassio@free.fr>
Sun, 22 Jul 2018 15:59:39 +0000 (17:59 +0200)
This is a non-functional simplification. We change replaces an 'OR'
and a lookup (rank_bb(ksq)) with a bitwise ~.  This is fewer operations
and is probably faster.

STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 25441 W: 5689 L: 5575 D: 14177
http://tests.stockfishchess.org/tests/view/5b52d05a0ebc5902bdb8010e

LTC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 26904 W: 4664 L: 4553 D: 17687
http://tests.stockfishchess.org/tests/view/5b543df70ebc5902bdb8212d

No functional change.

src/pawns.cpp

index 55462bcf1ca16c2054fab08d1c80826bdc166780..761d770e6772534ac15b859e210d901b47430918 100644 (file)
@@ -208,7 +208,7 @@ Value Entry::evaluate_shelter(const Position& pos, Square ksq) {
   constexpr Direction Down = (Us == WHITE ? SOUTH : NORTH);
   constexpr Bitboard  BlockRanks = (Us == WHITE ? Rank1BB | Rank2BB : Rank8BB | Rank7BB);
 
-  Bitboard b = pos.pieces(PAWN) & (forward_ranks_bb(Us, ksq) | rank_bb(ksq));
+  Bitboard b = pos.pieces(PAWN) & ~forward_ranks_bb(Them, ksq);
   Bitboard ourPawns = b & pos.pieces(Us);
   Bitboard theirPawns = b & pos.pieces(Them);