summaryrefslogtreecommitdiffstats
path: root/src/result_others.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2017-08-26 21:58:18 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2017-08-27 01:46:11 +0900
commit6b4805ca1a1b0758363d1bb8c4c996730e19dc5a (patch)
tree14780508e5273c86ced515d7a806de3bfa71ed24 /src/result_others.go
parent159699b5d7505b132d2299690d7bf9f79d5fbda4 (diff)
Optimize rank comparison on x86 (little-endian)
Diffstat (limited to 'src/result_others.go')
-rw-r--r--src/result_others.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/result_others.go b/src/result_others.go
new file mode 100644
index 00000000..e3363a8e
--- /dev/null
+++ b/src/result_others.go
@@ -0,0 +1,16 @@
+// +build !386,!amd64
+
+package fzf
+
+func compareRanks(irank Result, jrank Result, tac bool) bool {
+ for idx := 3; idx >= 0; 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
+}