@@ -662,32 +662,9 @@ public struct IndexPath : ReferenceConvertible, Equatable, Hashable, MutableColl
662
662
return . orderedSame
663
663
}
664
664
665
- public var hashValue : Int { // FIXME(hashValue): Remove
666
- func hashIndexes( first: Int , last: Int , count: Int ) -> Int {
667
- let totalBits = MemoryLayout < Int > . size * 8
668
- let lengthBits = 8
669
- let firstIndexBits = ( totalBits - lengthBits) / 2
670
- return count &+ ( first << lengthBits) &+ ( last << ( lengthBits + firstIndexBits) )
671
- }
672
-
673
- switch _indexes {
674
- case . empty: return 0
675
- case . single( let index) : return index. hashValue
676
- case . pair( let first, let second) :
677
- return hashIndexes ( first: first, last: second, count: 2 )
678
- default :
679
- let cnt = _indexes. count
680
- return hashIndexes ( first: _indexes [ 0 ] , last: _indexes [ cnt - 1 ] , count: cnt)
681
- }
682
- }
683
-
684
665
public func hash( into hasher: inout Hasher ) {
685
666
// Note: We compare all indices in ==, so for proper hashing, we must
686
- // also feed them all to the hasher. (This is intentionally different
687
- // from `hashValue` above, which only depends on the first and last
688
- // index. `Set` and `Dictionary` relies on `hash(into:)` rather than
689
- // `hashValue` -- the latter definition is only kept for compatibility
690
- // with existing code that may depend on it.)
667
+ // also feed them all to the hasher.
691
668
//
692
669
// To ensure we have unique hash encodings in nested hashing contexts,
693
670
// we combine the count of indices as well as the indices themselves.
0 commit comments