From: mstembera Date: Wed, 8 Jun 2016 00:09:57 +0000 (-0700) Subject: Avoid some redundant scaling function calls X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=0c076f11361da5c58ee927461391f2a0e3b6639b;ds=sidebyside Avoid some redundant scaling function calls Posted by Mohammed Li here: https://groups.google.com/forum/?fromgroups=#!topic/fishcooking/N-PHfN0O79o No functional change. --- diff --git a/src/material.h b/src/material.h index abd9ffaa..bec2d662 100644 --- a/src/material.h +++ b/src/material.h @@ -50,9 +50,9 @@ struct Entry { // the position. For instance, in KBP vs K endgames, the scaling function looks // for rook pawns and wrong-colored bishops. ScaleFactor scale_factor(const Position& pos, Color c) const { - return !scalingFunction[c] - || (*scalingFunction[c])(pos) == SCALE_FACTOR_NONE ? ScaleFactor(factor[c]) - : (*scalingFunction[c])(pos); + ScaleFactor sf = scalingFunction[c] ? (*scalingFunction[c])(pos) + : SCALE_FACTOR_NONE; + return sf != SCALE_FACTOR_NONE ? sf : ScaleFactor(factor[c]); } Key key;