mirror of https://github.com/xzeldon/htop.git
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.
This commit is contained in:
parent
9adcd9051a
commit
bea7f8e7af
|
@ -513,14 +513,11 @@ int Process_compare(const void* v1, const void* v2) {
|
||||||
|
|
||||||
int result = Process_compareByKey(p1, p2, key);
|
int result = Process_compareByKey(p1, p2, key);
|
||||||
|
|
||||||
if (Settings_getActiveDirection(settings) != 1)
|
|
||||||
result = -result;
|
|
||||||
|
|
||||||
// Implement tie-breaker (needed to make tree mode more stable)
|
// Implement tie-breaker (needed to make tree mode more stable)
|
||||||
if (!result)
|
if (!result)
|
||||||
return SPACESHIP_NUMBER(p1->pid, p2->pid);
|
return SPACESHIP_NUMBER(p1->pid, p2->pid);
|
||||||
|
|
||||||
return result;
|
return (Settings_getActiveDirection(settings) == 1) ? result : -result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t stateCompareValue(char state) {
|
static uint8_t stateCompareValue(char state) {
|
||||||
|
|
Loading…
Reference in New Issue