Skip to content

Commit ad1c957

Browse files
committed
Fixes example snippets in UnsafePointer.swift
1 parent c7aa067 commit ad1c957

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

stdlib/public/core/UnsafePointer.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@
108108
/// `load(fromByteOffset:as:)` method to read values.
109109
///
110110
/// 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
113113
///
114114
/// Performing Typed Pointer Arithmetic
115115
/// ===================================
@@ -260,7 +260,7 @@ public struct UnsafePointer<Pointee>: _Pointer {
260260
/// pointer to `Int64`, then accesses a property on the signed integer.
261261
///
262262
/// 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
264264
/// return ptr.pointee < 0
265265
/// }
266266
///
@@ -430,8 +430,8 @@ public struct UnsafePointer<Pointee>: _Pointer {
430430
/// to read and write values.
431431
///
432432
/// 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
435435
///
436436
/// Performing Typed Pointer Arithmetic
437437
/// ===================================
@@ -911,7 +911,7 @@ public struct UnsafeMutablePointer<Pointee>: _Pointer {
911911
/// pointer to `Int64`, then accesses a property on the signed integer.
912912
///
913913
/// 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
915915
/// return ptr.pointee < 0
916916
/// }
917917
///

0 commit comments

Comments
 (0)