File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -120,15 +120,15 @@ public func _stdlib_thread_join<Result>(
120
120
let result = WaitForSingleObject ( thread, 0xffffffff ) ;
121
121
// TODO(compnerd) modularize WinBase.h for WAIT_OBJECT_0 (0)
122
122
if result == 0 {
123
- let threadResult : DWORD = 0
123
+ var threadResult : DWORD = 0
124
124
GetExitCodeThread ( thread, & threadResult)
125
125
CloseHandle ( thread)
126
126
127
- return ( result,
127
+ return ( CInt ( result) ,
128
128
UnsafeMutablePointer < DWORD > ( & threadResult)
129
129
. withMemoryRebound ( to: Result . self, capacity: 1 ) { $0. pointee } )
130
130
} else {
131
- return ( result, nil )
131
+ return ( CInt ( result) , nil )
132
132
}
133
133
#else
134
134
var threadResultRawPtr : UnsafeMutableRawPointer ?
Original file line number Diff line number Diff line change 21
21
public func _dictionaryUpCast< DerivedKey, DerivedValue, BaseKey, BaseValue> (
22
22
_ source: Dictionary < DerivedKey , DerivedValue >
23
23
) -> Dictionary < BaseKey , BaseValue > {
24
- var result = Dictionary < BaseKey , BaseValue > ( minimumCapacity : source. count)
24
+ var builder = _DictionaryBuilder < BaseKey , BaseValue > ( count : source. count)
25
25
26
26
for (k, v) in source {
27
- result [ k as! BaseKey ] = ( v as! BaseValue )
27
+ builder . add ( key : k as! BaseKey , value : v as! BaseValue )
28
28
}
29
- return result
29
+ return builder . take ( )
30
30
}
31
31
32
32
/// Called by the casting machinery.
@@ -98,11 +98,11 @@ public func _dictionaryDownCastConditional<
98
98
_ source: Dictionary < BaseKey , BaseValue >
99
99
) -> Dictionary < DerivedKey , DerivedValue > ? {
100
100
101
- var result = Dictionary < DerivedKey , DerivedValue > ( )
101
+ var builder = _DictionaryBuilder < DerivedKey , DerivedValue > ( count : source . count )
102
102
for (k, v) in source {
103
103
guard let k1 = k as? DerivedKey , let v1 = v as? DerivedValue
104
104
else { return nil }
105
- result [ k1 ] = v1
105
+ builder . add ( key : k1 , value : v1)
106
106
}
107
- return result
107
+ return builder . take ( )
108
108
}
You can’t perform that action at this time.
0 commit comments