diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2017-08-26 21:58:18 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2017-08-27 01:46:11 +0900 |
commit | 6b4805ca1a1b0758363d1bb8c4c996730e19dc5a (patch) | |
tree | 14780508e5273c86ced515d7a806de3bfa71ed24 /src/result.go | |
parent | 159699b5d7505b132d2299690d7bf9f79d5fbda4 (diff) |
Optimize rank comparison on x86 (little-endian)
Diffstat (limited to 'src/result.go')
-rw-r--r-- | src/result.go | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/src/result.go b/src/result.go index 58cbafd7..289d83a0 100644 --- a/src/result.go +++ b/src/result.go @@ -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 -} |