From 0c076f11361da5c58ee927461391f2a0e3b6639b Mon Sep 17 00:00:00 2001 From: mstembera Date: Tue, 7 Jun 2016 17:09:57 -0700 Subject: [PATCH] Avoid some redundant scaling function calls Posted by Mohammed Li here: https://groups.google.com/forum/?fromgroups=#!topic/fishcooking/N-PHfN0O79o No functional change. --- src/material.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; -- 2.39.2