diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2021-03-12 16:44:46 +0100 |
---|---|---|
committer | Christian Göttsche <cgzones@googlemail.com> | 2021-03-12 16:44:46 +0100 |
commit | bea7f8e7afaab973d8086cc4b7d7978f06582f86 (patch) | |
tree | 3770b38b174449888b04734fec4f4f2033aa95d5 /Process.c | |
parent | 9adcd9051ab94fde4aa63de7673417e3cbd25f42 (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.c | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -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) { |