Skip to content

Commit bde23e2

Browse files
committed
[embedded] Avoid using reinterpretCast in set bridging
1 parent 29a7c52 commit bde23e2

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

stdlib/public/core/BridgeStorage.swift

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -179,16 +179,8 @@ internal struct _BridgeStorage<NativeClass: AnyObject> {
179179
@inline(__always)
180180
internal init(native: Native) {
181181
_internalInvariant(_usesNativeSwiftReferenceCounting(NativeClass.self))
182-
rawValue = Builtin.reinterpretCast(native)
183-
}
184-
185-
#if _pointerBitWidth(_64)
186-
@inlinable
187-
@inline(__always)
188-
internal init(taggedPayload: UInt) {
189-
rawValue = Builtin.reinterpretCast(taggedPayload)
182+
rawValue = native
190183
}
191-
#endif
192184

193185
@inlinable
194186
@inline(__always)

stdlib/public/core/SetVariant.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ extension Set {
3636
@inlinable
3737
@inline(__always)
3838
init(dummy: ()) {
39-
#if _pointerBitWidth(_64)
39+
#if _pointerBitWidth(_64) && !$Embedded
4040
self.object = _BridgeStorage(taggedPayload: 0)
41-
#elseif _pointerBitWidth(_32)
41+
#elseif _pointerBitWidth(_32) || $Embedded
4242
self.init(native: _NativeSet())
4343
#else
4444
#error("Unknown platform")

0 commit comments

Comments
 (0)