Skip to content

Commit af1ddfd

Browse files
protonspringsnicolet
authored andcommitted
simplified forward ranks.
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.
1 parent 4bd24da commit af1ddfd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/pawns.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ Value Entry::evaluate_shelter(const Position& pos, Square ksq) {
208208
constexpr Direction Down = (Us == WHITE ? SOUTH : NORTH);
209209
constexpr Bitboard BlockRanks = (Us == WHITE ? Rank1BB | Rank2BB : Rank8BB | Rank7BB);
210210

211-
Bitboard b = pos.pieces(PAWN) & (forward_ranks_bb(Us, ksq) | rank_bb(ksq));
211+
Bitboard b = pos.pieces(PAWN) & ~forward_ranks_bb(Them, ksq);
212212
Bitboard ourPawns = b & pos.pieces(Us);
213213
Bitboard theirPawns = b & pos.pieces(Them);
214214

0 commit comments

Comments
 (0)