mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 16:53:09 +00:00
Microptimization in do_evaluate()
Do not call count_1s_max_15() if not necessary, as is not in the common case (>95%). No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
8b45b60327
commit
8654fee18c
1 changed files with 7 additions and 2 deletions
|
@ -353,8 +353,13 @@ Value do_evaluate(const Position& pos, EvalInfo& ei, int threadID) {
|
|||
// Initialize pawn attack bitboards for both sides
|
||||
ei.attackedBy[WHITE][PAWN] = ((pos.pawns(WHITE) << 9) & ~FileABB) | ((pos.pawns(WHITE) << 7) & ~FileHBB);
|
||||
ei.attackedBy[BLACK][PAWN] = ((pos.pawns(BLACK) >> 7) & ~FileABB) | ((pos.pawns(BLACK) >> 9) & ~FileHBB);
|
||||
ei.kingAttackersCount[WHITE] = count_1s_max_15<HasPopCnt>(ei.attackedBy[WHITE][PAWN] & ei.attackedBy[BLACK][KING])/2;
|
||||
ei.kingAttackersCount[BLACK] = count_1s_max_15<HasPopCnt>(ei.attackedBy[BLACK][PAWN] & ei.attackedBy[WHITE][KING])/2;
|
||||
Bitboard b1 = ei.attackedBy[WHITE][PAWN] & ei.attackedBy[BLACK][KING];
|
||||
Bitboard b2 = ei.attackedBy[BLACK][PAWN] & ei.attackedBy[WHITE][KING];
|
||||
if (b1)
|
||||
ei.kingAttackersCount[WHITE] = count_1s_max_15<HasPopCnt>(b1)/2;
|
||||
|
||||
if (b2)
|
||||
ei.kingAttackersCount[BLACK] = count_1s_max_15<HasPopCnt>(b2)/2;
|
||||
|
||||
// Evaluate pieces
|
||||
for (Color c = WHITE; c <= BLACK; c++)
|
||||
|
|
Loading…
Add table
Reference in a new issue