mwindow: use multiplication instesad of conditionals This is a very verbose way of performing a comparison where we already have the identity value with both signs. Instead of chainging several conditions, we can rely on the maths working out.
diff --git a/src/libgit2/mwindow.c b/src/libgit2/mwindow.c
index 5c5f9a8..ad64949 100644
--- a/src/libgit2/mwindow.c
+++ b/src/libgit2/mwindow.c
@@ -240,9 +240,7 @@ static bool git_mwindow_scan_recently_used(
* store it in the output parameter. If lru_window is NULL,
* it's the first loop, so store it as well.
*/
- if (!lru_window ||
- (comparison_sign == GIT_MWINDOW__LRU && lru_window->last_used > w->last_used) ||
- (comparison_sign == GIT_MWINDOW__MRU && lru_window->last_used < w->last_used)) {
+ if (!lru_window || (comparison_sign * w->last_used) > lru_window->last_used) {
lru_window = w;
lru_last = w_last;
found = true;