Skip to content

Commit

Permalink
Fixed Swift 3 warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Frugghi committed Apr 26, 2016
1 parent 9def53c commit 0e41a92
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
6 changes: 1 addition & 5 deletions SwiftLCS/SwiftLCS+Foundation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ public extension Diff {
private func toIndexSet(diff: (indexes: [Index], startIndex: Index)) -> NSIndexSet {
let indexSet = NSMutableIndexSet()
diff.indexes.forEach { index in
var i = 0
for var countIndex = diff.startIndex; countIndex.distanceTo(index) > 0; countIndex = countIndex.successor() {
i++
}
indexSet.addIndex(i)
indexSet.addIndex(Int(diff.startIndex.distanceTo(index).toIntMax()))
}

return indexSet
Expand Down
8 changes: 4 additions & 4 deletions SwiftLCS/SwiftLCS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ public extension CollectionType where Generator.Element: Equatable, Index: Bidir
while row < lengths.rows - 1 && column < lengths.columns - 1 {
if self[row] == collection[column] {
commonIndexes.append(row)
row++
column++
row = row.successor()
column = column.successor()
} else if lengths[row+1, column] >= lengths[row, column+1] {
row++
row = row.successor()
} else {
column++
column = column.successor()
}
}

Expand Down

0 comments on commit 0e41a92

Please sign in to comment.