Skip to content

Commit 09000e9

Browse files
committed
[stdlib] Change an unsafeBitCast to init(bitPattern:).
...now that we have this particular 'init(bitPattern:)'. No functionality change, verified by looking at -emit-ir for this function.
1 parent 2e38280 commit 09000e9

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

stdlib/public/core/Runtime.swift.gyb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@ func _stdlib_atomicCompareExchangeStrongPtrImpl(
2828
expected: UnsafeMutablePointer<OpaquePointer?>,
2929
desired: OpaquePointer?) -> Bool {
3030

31-
// Bit-cast directly from 'OpaquePointer?' to 'Builtin.Word' because
32-
// Builtin.RawPointer can't be nil.
31+
// We use Builtin.Word here because Builtin.RawPointer can't be nil.
3332
let (oldValue, won) = Builtin.cmpxchg_seqcst_seqcst_Word(
3433
target._rawValue,
35-
unsafeBitCast(expected.pointee, to: Builtin.Word.self),
36-
unsafeBitCast(desired, to: Builtin.Word.self))
34+
UInt(bitPattern: expected.pointee)._builtinWordValue,
35+
UInt(bitPattern: desired)._builtinWordValue)
3736
expected.pointee = OpaquePointer(bitPattern: Int(oldValue))
3837
return Bool(won)
3938
}

0 commit comments

Comments
 (0)