@@ -20,7 +20,7 @@ import SwiftShims
20
20
// rdar://problem/38549901
21
21
@usableFromInline
22
22
internal protocol _HasherCore {
23
- init ( seed: ( UInt64 , UInt64 ) )
23
+ init ( seed: Hasher . _Seed )
24
24
mutating func compress( _ value: UInt64 )
25
25
mutating func finalize( tailAndByteCount: UInt64 ) -> UInt64
26
26
@@ -33,7 +33,7 @@ internal protocol _HasherCore {
33
33
/// This comes handy when type's _hash(into:) implementation needs to perform
34
34
/// one-shot hashing for some of its components. (E.g., for commutative
35
35
/// hashing.)
36
- func _generateSeed( ) -> ( UInt64 , UInt64 )
36
+ func _generateSeed( ) -> Hasher . _Seed
37
37
}
38
38
39
39
@inline ( __always)
@@ -160,7 +160,7 @@ internal struct _BufferingHasher<Core: _HasherCore> {
160
160
private var _core : Core
161
161
162
162
@inline ( __always)
163
- internal init ( seed: ( UInt64 , UInt64 ) ) {
163
+ internal init ( seed: Hasher . _Seed ) {
164
164
self . _buffer = _HasherTailBuffer ( )
165
165
self . _core = Core ( seed: seed)
166
166
}
@@ -252,7 +252,7 @@ internal struct _BufferingHasher<Core: _HasherCore> {
252
252
// Generate a seed value from the current state of this hasher.
253
253
// FIXME(hasher): Remove
254
254
@inline ( __always)
255
- internal func _generateSeed( ) -> ( UInt64 , UInt64 ) {
255
+ internal func _generateSeed( ) -> Hasher . _Seed {
256
256
return _core. _generateSeed ( )
257
257
}
258
258
@@ -296,6 +296,9 @@ public struct Hasher {
296
296
@usableFromInline
297
297
internal typealias Core = _BufferingHasher < RawCore >
298
298
299
+ @usableFromInline
300
+ internal typealias _Seed = ( UInt64 , UInt64 )
301
+
299
302
internal var _core : Core
300
303
301
304
/// Creates a new hasher.
@@ -310,7 +313,7 @@ public struct Hasher {
310
313
/// Initialize a new hasher using the specified seed value.
311
314
@usableFromInline
312
315
@_effects ( releasenone)
313
- internal init ( _seed seed: ( UInt64 , UInt64 ) ) {
316
+ internal init ( _seed seed: _Seed ) {
314
317
self . _core = Core ( seed: seed)
315
318
}
316
319
@@ -331,7 +334,7 @@ public struct Hasher {
331
334
/// The 128-bit hash seed used to initialize the hasher state. Initialized
332
335
/// once during process startup.
333
336
@inlinable
334
- internal static var _seed : ( UInt64 , UInt64 ) {
337
+ internal static var _seed : _Seed {
335
338
@inline ( __always)
336
339
get {
337
340
// The seed itself is defined in C++ code so that it is initialized during
@@ -428,13 +431,13 @@ public struct Hasher {
428
431
// FIXME(hasher): Remove
429
432
@_effects ( readnone)
430
433
@usableFromInline
431
- internal func _generateSeed( ) -> ( UInt64 , UInt64 ) {
434
+ internal func _generateSeed( ) -> Hasher . _Seed {
432
435
return _core. _generateSeed ( )
433
436
}
434
437
435
438
@_effects ( readnone)
436
439
@usableFromInline
437
- internal static func _hash( seed: ( UInt64 , UInt64 ) , _ value: UInt64 ) -> Int {
440
+ internal static func _hash( seed: _Seed , _ value: UInt64 ) -> Int {
438
441
var core = RawCore ( seed: seed)
439
442
core. compress ( value)
440
443
let tbc = _HasherTailBuffer ( tail: 0 , byteCount: 8 )
@@ -443,7 +446,7 @@ public struct Hasher {
443
446
444
447
@_effects ( readnone)
445
448
@usableFromInline
446
- internal static func _hash( seed: ( UInt64 , UInt64 ) , _ value: UInt ) -> Int {
449
+ internal static func _hash( seed: _Seed , _ value: UInt ) -> Int {
447
450
var core = RawCore ( seed: seed)
448
451
#if arch(i386) || arch(arm)
449
452
_sanityCheck ( UInt . bitWidth < UInt64 . bitWidth)
@@ -461,7 +464,7 @@ public struct Hasher {
461
464
@_effects ( readnone)
462
465
@usableFromInline
463
466
internal static func _hash(
464
- seed: ( UInt64 , UInt64 ) ,
467
+ seed: _Seed ,
465
468
bytes value: UInt64 ,
466
469
count: Int ) -> Int {
467
470
_sanityCheck ( count >= 0 && count < 8 )
@@ -473,7 +476,7 @@ public struct Hasher {
473
476
@_effects ( readnone)
474
477
@usableFromInline
475
478
internal static func _hash(
476
- seed: ( UInt64 , UInt64 ) ,
479
+ seed: _Seed ,
477
480
bytes: UnsafeRawBufferPointer ) -> Int {
478
481
var core = Core ( seed: seed)
479
482
core. combine ( bytes: bytes)
0 commit comments