Skip to content

Commit

Permalink
Stop overfixing in fetchOverlappingNodes(). (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShikiSuen authored Aug 10, 2022
1 parent ed124da commit 8aa9dd6
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions Sources/Megrez/4_Span.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,8 @@ extension Megrez.Compositor {
// 再獲取以當前位置結尾或開頭的節點。
let begin: Int = location - min(location, Megrez.Compositor.maxSpanLength - 1)
for theLocation in begin..<location {
let (A, B): (Int, Int) = {
(
min(location - theLocation + 1, spans[theLocation].maxLength),
max(location - theLocation + 1, spans[theLocation].maxLength)
)
}()
let (A, B): (Int, Int) = (location - theLocation + 1, spans[theLocation].maxLength)
guard A <= B else { continue }
for theLength in A...B {
guard let node = spans[theLocation].nodeOf(length: theLength) else { continue }
results.append(.init(node: node, spanIndex: theLocation))
Expand Down

0 comments on commit 8aa9dd6

Please sign in to comment.