mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-18 22:13:49 -07:00
Optimize rank comparison on x86 (little-endian)
This commit is contained in:
16
src/result_x86.go
Normal file
16
src/result_x86.go
Normal file
@@ -0,0 +1,16 @@
|
||||
// +build 386 amd64
|
||||
|
||||
package fzf
|
||||
|
||||
import "unsafe"
|
||||
|
||||
func compareRanks(irank Result, jrank Result, tac bool) bool {
|
||||
left := *(*uint64)(unsafe.Pointer(&irank.points[0]))
|
||||
right := *(*uint64)(unsafe.Pointer(&jrank.points[0]))
|
||||
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