mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 17:16:33 +08:00
Micro optimize extension() in search.cpp
Small micro-optimization in this very time critical function. Use bitwise 'or' instead of logic 'or' to avoid branches in the assembly and use the result to skip an handful of checks. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -2202,16 +2202,19 @@ namespace {
|
||||
assert(m != MOVE_NONE);
|
||||
|
||||
Depth result = Depth(0);
|
||||
*dangerous = check || singleReply || mateThreat;
|
||||
*dangerous = check | singleReply | mateThreat;
|
||||
|
||||
if (check)
|
||||
result += CheckExtension[pvNode];
|
||||
if (*dangerous)
|
||||
{
|
||||
if (check)
|
||||
result += CheckExtension[pvNode];
|
||||
|
||||
if (singleReply)
|
||||
result += SingleReplyExtension[pvNode];
|
||||
if (singleReply)
|
||||
result += SingleReplyExtension[pvNode];
|
||||
|
||||
if (mateThreat)
|
||||
result += MateThreatExtension[pvNode];
|
||||
if (mateThreat)
|
||||
result += MateThreatExtension[pvNode];
|
||||
}
|
||||
|
||||
if (pos.type_of_piece_on(move_from(m)) == PAWN)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user