|
108 | 108 | /// `load(fromByteOffset:as:)` method to read values.
|
109 | 109 | ///
|
110 | 110 | /// let rawPointer = UnsafeRawPointer(uint64Pointer)
|
111 |
| -/// fullInteger = rawPointer.load(as: UInt64.self) // OK |
112 |
| -/// firstByte = rawPointer.load(as: UInt8.self) // OK |
| 111 | +/// let fullInteger = rawPointer.load(as: UInt64.self) // OK |
| 112 | +/// let firstByte = rawPointer.load(as: UInt8.self) // OK |
113 | 113 | ///
|
114 | 114 | /// Performing Typed Pointer Arithmetic
|
115 | 115 | /// ===================================
|
@@ -260,7 +260,7 @@ public struct UnsafePointer<Pointee>: _Pointer {
|
260 | 260 | /// pointer to `Int64`, then accesses a property on the signed integer.
|
261 | 261 | ///
|
262 | 262 | /// let uint64Pointer: UnsafePointer<UInt64> = fetchValue()
|
263 |
| - /// let isNegative = uint64Pointer.withMemoryRebound(to: Int64.self) { ptr in |
| 263 | + /// let isNegative = uint64Pointer.withMemoryRebound(to: Int64.self, capacity: 1) { ptr in |
264 | 264 | /// return ptr.pointee < 0
|
265 | 265 | /// }
|
266 | 266 | ///
|
@@ -430,8 +430,8 @@ public struct UnsafePointer<Pointee>: _Pointer {
|
430 | 430 | /// to read and write values.
|
431 | 431 | ///
|
432 | 432 | /// let rawPointer = UnsafeMutableRawPointer(uint64Pointer)
|
433 |
| -/// fullInteger = rawPointer.load(as: UInt64.self) // OK |
434 |
| -/// firstByte = rawPointer.load(as: UInt8.self) // OK |
| 433 | +/// let fullInteger = rawPointer.load(as: UInt64.self) // OK |
| 434 | +/// let firstByte = rawPointer.load(as: UInt8.self) // OK |
435 | 435 | ///
|
436 | 436 | /// Performing Typed Pointer Arithmetic
|
437 | 437 | /// ===================================
|
@@ -911,7 +911,7 @@ public struct UnsafeMutablePointer<Pointee>: _Pointer {
|
911 | 911 | /// pointer to `Int64`, then accesses a property on the signed integer.
|
912 | 912 | ///
|
913 | 913 | /// let uint64Pointer: UnsafeMutablePointer<UInt64> = fetchValue()
|
914 |
| - /// let isNegative = uint64Pointer.withMemoryRebound(to: Int64.self) { ptr in |
| 914 | + /// let isNegative = uint64Pointer.withMemoryRebound(to: Int64.self, capacity: 1) { ptr in |
915 | 915 | /// return ptr.pointee < 0
|
916 | 916 | /// }
|
917 | 917 | ///
|
|
0 commit comments