refactor: don't use subtraction in qsort() comparison functions

This commit is contained in:
zeertzjq
2024-02-10 21:38:48 +08:00
parent f3982ad3f3
commit 00e785b17f
6 changed files with 36 additions and 17 deletions

View File

@@ -375,7 +375,7 @@ static int nv_compare(const void *s1, const void *s2)
if (c2 < 0) {
c2 = -c2;
}
return c1 - c2;
return c1 == c2 ? 0 : c1 > c2 ? 1 : -1;
}
/// Initialize the nv_cmd_idx[] table.