File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -336,7 +336,9 @@ public struct UnsafePointer<Pointee>: _Pointer {
336336 capacity count: Int ,
337337 _ body: ( UnsafePointer < T > ) throws -> Result
338338 ) rethrows -> Result {
339- return try withMemoryRebound ( to: T . self, capacity: count, body)
339+ let binding = Builtin . bindMemory ( _rawValue, count. _builtinWordValue, T . self)
340+ defer { Builtin . rebindMemory ( _rawValue, binding) }
341+ return try body ( . init( _rawValue) )
340342 }
341343
342344 /// Accesses the pointee at the specified offset from this pointer.
@@ -1040,7 +1042,9 @@ public struct UnsafeMutablePointer<Pointee>: _Pointer {
10401042 capacity count: Int ,
10411043 _ body: ( UnsafeMutablePointer < T > ) throws -> Result
10421044 ) rethrows -> Result {
1043- return try withMemoryRebound ( to: T . self, capacity: count, body)
1045+ let binding = Builtin . bindMemory ( _rawValue, count. _builtinWordValue, T . self)
1046+ defer { Builtin . rebindMemory ( _rawValue, binding) }
1047+ return try body ( . init( _rawValue) )
10441048 }
10451049
10461050 /// Accesses the pointee at the specified offset from this pointer.
You can’t perform that action at this time.
0 commit comments