Skip ei.kingZone[] initialization together with king safety
authorMarco Costalba <mcostalba@gmail.com>
Tue, 5 Oct 2010 21:22:44 +0000 (22:22 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Tue, 5 Oct 2010 21:32:53 +0000 (22:32 +0100)
Another microptimization by Marek Kwiatkowski.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/evaluate.cpp

index 041ce86f8917aa910f33060d58808258b8f26ea1..0f116a85b7f0f99456ce647f72c53ae7441181f4 100644 (file)
@@ -442,11 +442,11 @@ namespace {
     const Color Them = (Us == WHITE ? BLACK : WHITE);
 
     Bitboard b = ei.attackedBy[Them][KING] = pos.attacks_from<KING>(pos.king_square(Them));
-    ei.kingZone[Us] = (b | (Us == WHITE ? b >> 8 : b << 8));
     ei.attackedBy[Us][PAWN] = ei.pi->pawn_attacks(Us);
     ei.updateKingTables[Us] = pos.piece_count(Us, QUEEN) && pos.non_pawn_material(Us) >= QueenValueMidgame + RookValueMidgame;
     if (ei.updateKingTables[Us])
     {
+        ei.kingZone[Us] = (b | (Us == WHITE ? b >> 8 : b << 8));
         b &= ei.attackedBy[Us][PAWN];
         ei.kingAttackersCount[Us] = b ? count_1s<Max15>(b) / 2 : EmptyBoardBB;
         ei.kingAdjacentZoneAttacksCount[Us] = ei.kingAttackersWeight[Us] = EmptyBoardBB;