Skip to content

Commit 7bfcc14

Browse files
authored
Update the Hashable implementations. (#14)
1 parent ba03817 commit 7bfcc14

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

FlexibleDiff/Changeset.swift

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -468,12 +468,6 @@ private struct MovePath: Hashable {
468468
let source: Int
469469
let destination: Int
470470

471-
func hash(into hasher: inout Hasher) {
472-
let sum = source + destination
473-
let hash = (sum * (sum + 1)) >> 1 + destination
474-
hasher.combine(hash)
475-
}
476-
477471
func shifted(by offset: Int) -> MovePath {
478472
return MovePath(source: source + offset, destination: destination + offset)
479473
}
@@ -499,9 +493,8 @@ extension Set where Element == Int {
499493

500494
extension Changeset.Move: Hashable {
501495
public func hash(into hasher: inout Hasher) {
502-
let sum = source + destination
503-
let hash = (sum * (sum + 1)) >> 1 + destination
504-
hasher.combine(hash)
496+
hasher.combine(source)
497+
hasher.combine(destination)
505498
}
506499

507500
public static func == (left: Changeset.Move, right: Changeset.Move) -> Bool {

0 commit comments

Comments
 (0)