mirror of
https://github.com/sockspls/badfish
synced 2025-05-02 09:39:36 +00:00
Remove confusing optimization
Here we skip the call to pos.attacks_from<ROOK>(s) in the 98% of cases, testing the first 2 members first. Unfortunatly code is a bit triky and not clear. So we give up to the speed optimization in exchange of more code clarity. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
7b31e81d77
commit
e05c80a088
1 changed files with 1 additions and 2 deletions
|
@ -821,8 +821,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
|
||||||
// If there is an enemy rook or queen attacking the pawn from behind,
|
// If there is an enemy rook or queen attacking the pawn from behind,
|
||||||
// add all X-ray attacks by the rook or queen. Otherwise consider only
|
// add all X-ray attacks by the rook or queen. Otherwise consider only
|
||||||
// the squares in the pawn's path attacked or occupied by the enemy.
|
// the squares in the pawn's path attacked or occupied by the enemy.
|
||||||
if ( (forward_bb(Them, s) & pos.pieces(Them, ROOK, QUEEN))
|
if (forward_bb(Them, s) & pos.pieces(Them, ROOK, QUEEN) & pos.attacks_from<ROOK>(s))
|
||||||
&& (forward_bb(Them, s) & pos.pieces(Them, ROOK, QUEEN) & pos.attacks_from<ROOK>(s)))
|
|
||||||
unsafeSquares = squaresToQueen;
|
unsafeSquares = squaresToQueen;
|
||||||
else
|
else
|
||||||
unsafeSquares = squaresToQueen & (ei.attackedBy[Them][ALL_PIECES] | pos.pieces(Them));
|
unsafeSquares = squaresToQueen & (ei.attackedBy[Them][ALL_PIECES] | pos.pieces(Them));
|
||||||
|
|
Loading…
Add table
Reference in a new issue