@@ -168,35 +168,6 @@ func _mixInt(_ value: Int) -> Int {
168
168
#endif
169
169
}
170
170
171
- /// Given a hash value, returns an integer value in the range of
172
- /// 0..<`upperBound` that corresponds to a hash value.
173
- ///
174
- /// The `upperBound` must be positive and a power of 2.
175
- ///
176
- /// This function is superior to computing the remainder of `hashValue` by
177
- /// the range length. Some types have bad hash functions; sometimes simple
178
- /// patterns in data sets create patterns in hash values and applying the
179
- /// remainder operation just throws away even more information and invites
180
- /// even more hash collisions. This effect is especially bad because the
181
- /// range is a power of two, which means to throws away high bits of the hash
182
- /// (which would not be a problem if the hash was known to be good). This
183
- /// function mixes the bits in the hash value to compensate for such cases.
184
- ///
185
- /// Of course, this function is a compressing function, and applying it to a
186
- /// hash value does not change anything fundamentally: collisions are still
187
- /// possible, and it does not prevent malicious users from constructing data
188
- /// sets that will exhibit pathological collisions.
189
- @_inlineable // FIXME(sil-serialize-all)
190
- public // @testable
191
- func _squeezeHashValue( _ hashValue: Int , _ upperBound: Int ) -> Int {
192
- _sanityCheck ( _isPowerOf2 ( upperBound) )
193
- let mixedHashValue = _mixInt ( hashValue)
194
-
195
- // As `upperBound` is a power of two we can do a bitwise-and to calculate
196
- // mixedHashValue % upperBound.
197
- return mixedHashValue & ( upperBound &- 1 )
198
- }
199
-
200
171
/// Returns a new value that combines the two given hash values.
201
172
///
202
173
/// Combining is performed using [a hash function][ref] described by T.C. Hoad
0 commit comments