summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
1b0303b)
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>
assert(m != MOVE_NONE);
Depth result = Depth(0);
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)
{
if (pos.type_of_piece_on(move_from(m)) == PAWN)
{