sort: tune diff_reversed

* src/sort.c (diff_reversed): Tune.  On x86-64 with GCC, this
saves a conditional branch and shortens the generated machine code.
This commit is contained in:
Paul Eggert committed 2022-05-25 11:24:09 -07:00
1 parent dc457c5e1b
commit 9104dad18b
1 file changed
+1 -1
+1 -1
View File
@@ -2607,7 +2607,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
static int
diff_reversed (int diff, bool reversed)
{
return reversed ? (diff < 0 ? 1 : -diff) : diff;
return reversed ? (diff < 0) - (diff > 0) : diff;
}
/* Compare two lines A and B trying every key in sequence until there