From: Andre Noll Date: Wed, 4 Sep 2013 19:26:46 +0000 (+0000) Subject: mood: Combine compute_num_played_score() and compute_last_played_score(). X-Git-Tag: v0.5.1~6^2~1 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=f24778705c853647f48b89c8d27ba1ded27a6f29;p=paraslash.git mood: Combine compute_num_played_score() and compute_last_played_score(). These two functions have only one caller, compute_dynamic_score(), which just adds the two return values. Let's combine all three functions to a single one. --- diff --git a/mood.c b/mood.c index db5d8afc..2cb7bc69 100644 --- a/mood.c +++ b/mood.c @@ -462,21 +462,12 @@ static int64_t normalized_value(int64_t x, int64_t n, int64_t sum, int64_t qd) return 100 * (n * x - sum) / (int64_t)int_sqrt(n * qd); } -static long compute_num_played_score(struct afs_info *afsi) -{ - return -normalized_value(afsi->num_played, statistics.num, - statistics.num_played_sum, statistics.num_played_qd); -} - -static long compute_last_played_score(struct afs_info *afsi) -{ - return -normalized_value(afsi->last_played, statistics.num, - statistics.last_played_sum, statistics.last_played_qd); -} - static long compute_dynamic_score(struct afs_info *afsi) { - return compute_num_played_score(afsi) + compute_last_played_score(afsi); + return -normalized_value(afsi->num_played, statistics.num, + statistics.num_played_sum, statistics.num_played_qd) + - normalized_value(afsi->last_played, statistics.num, + statistics.last_played_sum, statistics.last_played_qd); } static int add_afs_statistics(const struct osl_row *row)