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 {
336
336
capacity count: Int ,
337
337
_ body: ( UnsafePointer < T > ) throws -> Result
338
338
) 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) )
340
342
}
341
343
342
344
/// Accesses the pointee at the specified offset from this pointer.
@@ -1040,7 +1042,9 @@ public struct UnsafeMutablePointer<Pointee>: _Pointer {
1040
1042
capacity count: Int ,
1041
1043
_ body: ( UnsafeMutablePointer < T > ) throws -> Result
1042
1044
) 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) )
1044
1048
}
1045
1049
1046
1050
/// Accesses the pointee at the specified offset from this pointer.
You can’t perform that action at this time.
0 commit comments