]> git.tue.mpg.de Git - paraslash.git/commitdiff
mood: Combine compute_num_played_score() and compute_last_played_score().
authorAndre Noll <maan@systemlinux.org>
Wed, 4 Sep 2013 19:26:46 +0000 (19:26 +0000)
committerAndre Noll <maan@systemlinux.org>
Sun, 13 Oct 2013 13:25:06 +0000 (15:25 +0200)
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.

mood.c

diff --git a/mood.c b/mood.c
index db5d8afc6d13c6ecb892545844ae0c45ee469dd2..2cb7bc699f3688985565142af40762a73ea82311 100644 (file)
--- 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)