mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 17:16:33 +08:00
Micro-optimize king evaluation
Reuse already calculated value, instead of calling king_safety() again. Patch suggested by Balint Pfliegel. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -775,7 +775,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
|
|||||||
attackUnits = std::min(25, (ei.kingAttackersCount[Them] * ei.kingAttackersWeight[Them]) / 2)
|
attackUnits = std::min(25, (ei.kingAttackersCount[Them] * ei.kingAttackersWeight[Them]) / 2)
|
||||||
+ 3 * (ei.kingAdjacentZoneAttacksCount[Them] + popcount<Max15>(undefended))
|
+ 3 * (ei.kingAdjacentZoneAttacksCount[Them] + popcount<Max15>(undefended))
|
||||||
+ InitKingDanger[relative_square(Us, ksq)]
|
+ InitKingDanger[relative_square(Us, ksq)]
|
||||||
- mg_value(ei.pi->king_safety<Us>(pos, ksq)) / 32;
|
- mg_value(score) / 32;
|
||||||
|
|
||||||
// Analyse enemy's safe queen contact checks. First find undefended
|
// Analyse enemy's safe queen contact checks. First find undefended
|
||||||
// squares around the king attacked by enemy queen...
|
// squares around the king attacked by enemy queen...
|
||||||
|
|||||||
Reference in New Issue
Block a user