summaryrefslogtreecommitdiffstats
path: root/Process.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2021-03-12 16:44:46 +0100
committerChristian Göttsche <cgzones@googlemail.com>2021-03-12 16:44:46 +0100
commitbea7f8e7afaab973d8086cc4b7d7978f06582f86 (patch)
tree3770b38b174449888b04734fec4f4f2033aa95d5 /Process.c
parent9adcd9051ab94fde4aa63de7673417e3cbd25f42 (diff)
Process_compare: reorder checks
Check for result being 0 first, before checking if the result might be negated, so we do not need to negate 0.
Diffstat (limited to 'Process.c')
-rw-r--r--Process.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/Process.c b/Process.c
index 58bd6a90..d80ad796 100644
--- a/Process.c
+++ b/Process.c
@@ -513,14 +513,11 @@ int Process_compare(const void* v1, const void* v2) {
int result = Process_compareByKey(p1, p2, key);
- if (Settings_getActiveDirection(settings) != 1)
- result = -result;
-
// Implement tie-breaker (needed to make tree mode more stable)
if (!result)
return SPACESHIP_NUMBER(p1->pid, p2->pid);
- return result;
+ return (Settings_getActiveDirection(settings) == 1) ? result : -result;
}
static uint8_t stateCompareValue(char state) {

© 2014-2024 Faster IT GmbH | imprint | privacy policy