]> git.sesse.net Git - stockfish/commitdiff
Revert "Remove confusing optimization"
authorMarco Costalba <mcostalba@gmail.com>
Tue, 2 Jul 2013 18:06:24 +0000 (20:06 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Tue, 2 Jul 2013 18:12:57 +0000 (20:12 +0200)
This reverts commit e05c80a08859f6c4f0f599ca0b262ced00ad66fe.

we gain a speed up of 1.5% under gcc !

No functional change.

src/evaluate.cpp

index 68984802e5193185aae5b3f648173563948bd94d..c5af2f89524e5f9c04b89bb5c1780d8caa105911 100644 (file)
@@ -821,7 +821,8 @@ Value do_evaluate(const Position& pos, Value& margin) {
                 // 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
                 // the squares in the pawn's path attacked or occupied by the enemy.
-                if (forward_bb(Them, s) & pos.pieces(Them, ROOK, QUEEN) & pos.attacks_from<ROOK>(s))
+                if (   (forward_bb(Them, s) & pos.pieces(Them, ROOK, QUEEN)) // Unlikely
+                    && (forward_bb(Them, s) & pos.pieces(Them, ROOK, QUEEN) & pos.attacks_from<ROOK>(s)))
                     unsafeSquares = squaresToQueen;
                 else
                     unsafeSquares = squaresToQueen & (ei.attackedBy[Them][ALL_PIECES] | pos.pieces(Them));