mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-16 23:33:39 -05:00
Optimize rank comparison on x86 (little-endian)
This commit is contained in:
@@ -70,7 +70,7 @@ func buildResult(item *Item, offsets []Offset, score int) Result {
|
||||
}
|
||||
}
|
||||
}
|
||||
result.points[idx] = val
|
||||
result.points[3-idx] = val
|
||||
}
|
||||
|
||||
return result
|
||||
@@ -224,16 +224,3 @@ func (a ByRelevanceTac) Swap(i, j int) {
|
||||
func (a ByRelevanceTac) Less(i, j int) bool {
|
||||
return compareRanks(a[i], a[j], true)
|
||||
}
|
||||
|
||||
func compareRanks(irank Result, jrank Result, tac bool) bool {
|
||||
for idx := 0; idx < 4; idx++ {
|
||||
left := irank.points[idx]
|
||||
right := jrank.points[idx]
|
||||
if left < right {
|
||||
return true
|
||||
} else if left > right {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return (irank.item.Index() <= jrank.item.Index()) != tac
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user