Commit 0f594445 by Carlos Martín Nieto

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.
parent 55c84333
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment