Skip to content

[SE-0101] Implement: Reconfiguring sizeof and related functions into a unified MemoryLayout struct - Part 1 #3854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmark/single-source/BitCount.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import Foundation
import TestsUtils

func countBitSet(_ num: Int) -> Int {
let bits = sizeof(Int.self) * 8
let bits = MemoryLayout<Int>.size * 8
var cnt: Int = 0
var mask: Int = 1
for _ in 0...bits {
Expand Down
2 changes: 1 addition & 1 deletion stdlib/private/SwiftPrivateLibcExtras/Subprocess.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public func spawnChild(_ args: [String])

// If execve() encountered an error, we write the errno encountered to the
// parent write pipe.
let errnoSize = sizeof(errno.dynamicType)
let errnoSize = MemoryLayout._ofInstance(errno).size
var execveErrno = errno
let writtenBytes = withUnsafePointer(to: &execveErrno) {
write(childToParentPipe.writeFD, UnsafePointer($0), errnoSize)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public var _stdlib_FD_SETSIZE: CInt {
public struct _stdlib_fd_set {
var _data: [UInt]
static var _wordBits: Int {
return sizeof(UInt.self) * 8
return MemoryLayout<UInt>.size * 8
}

public init() {
Expand Down
30 changes: 15 additions & 15 deletions stdlib/private/SwiftReflectionTest/SwiftReflectionTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,21 +157,21 @@ internal func sendAddress(of instance: AnyObject) {
debugLog("BEGIN \(#function)")
defer { debugLog("END \(#function)") }
var address = Unmanaged.passUnretained(instance).toOpaque()
sendBytes(from: &address, count: sizeof(UInt.self))
sendBytes(from: &address, count: MemoryLayout<UInt>.size)
}

/// Send the `value`'s bits to the parent.
internal func sendValue<T>(_ value: T) {
debugLog("BEGIN \(#function)"); defer { debugLog("END \(#function)") }
var value = value
sendBytes(from: &value, count: sizeof(T.self))
sendBytes(from: &value, count: MemoryLayout<T>.size)
}

/// Read a word-sized unsigned integer from the parent.
internal func readUInt() -> UInt {
debugLog("BEGIN \(#function)"); defer { debugLog("END \(#function)") }
var value: UInt = 0
fread(&value, sizeof(UInt.self), 1, stdin)
fread(&value, MemoryLayout<UInt>.size, 1, stdin)
return value
}

Expand All @@ -184,7 +184,7 @@ internal func sendReflectionInfos() {
var numInfos = infos.count
debugLog("\(numInfos) reflection info bundles.")
precondition(numInfos >= 1)
sendBytes(from: &numInfos, count: sizeof(UInt.self))
sendBytes(from: &numInfos, count: MemoryLayout<UInt>.size)
for info in infos {
debugLog("Sending info for \(info.imageName)")
for section in info {
Expand Down Expand Up @@ -247,7 +247,7 @@ internal func sendStringLength() {
/// Send the size of this architecture's pointer type.
internal func sendPointerSize() {
debugLog("BEGIN \(#function)"); defer { debugLog("END \(#function)") }
let pointerSize = UInt8(sizeof(UnsafeRawPointer.self))
let pointerSize = UInt8(MemoryLayout<UnsafeRawPointer>.size)
sendValue(pointerSize)
}

Expand Down Expand Up @@ -357,11 +357,11 @@ public func reflect(object: AnyObject) {
/// an Any existential.
public func reflect<T>(any: T) {
let any: Any = any
let anyPointer = UnsafeMutablePointer<Any>.allocate(capacity: sizeof(Any.self))
let anyPointer = UnsafeMutablePointer<Any>.allocate(capacity: MemoryLayout<Any>.size)
anyPointer.initialize(to: any)
let anyPointerValue = unsafeBitCast(anyPointer, to: UInt.self)
reflect(instanceAddress: anyPointerValue, kind: .Existential)
anyPointer.deallocate(capacity: sizeof(Any.self))
anyPointer.deallocate(capacity: MemoryLayout<Any>.size)
}

// Reflect an `Error`, a.k.a. an "error existential".
Expand Down Expand Up @@ -421,61 +421,61 @@ struct ThickFunctionParts {
/// @convention(thick) function value.
public func reflect(function: () -> ()) {
let fn = UnsafeMutablePointer<ThickFunction0>.allocate(
capacity: sizeof(ThickFunction0.self))
capacity: MemoryLayout<ThickFunction0>.size)
fn.initialize(to: ThickFunction0(function: function))

let parts = unsafeBitCast(fn, to: UnsafePointer<ThickFunctionParts>.self)
let contextPointer = unsafeBitCast(parts.pointee.context, to: UInt.self)

reflect(instanceAddress: contextPointer, kind: .Object)

fn.deallocate(capacity: sizeof(ThickFunction0.self))
fn.deallocate(capacity: MemoryLayout<ThickFunction0>.size)
}

/// Reflect a closure context. The given function must be a Swift-native
/// @convention(thick) function value.
public func reflect(function: (Int) -> ()) {
let fn =
UnsafeMutablePointer<ThickFunction1>.allocate(
capacity: sizeof(ThickFunction1.self))
capacity: MemoryLayout<ThickFunction1>.size)
fn.initialize(to: ThickFunction1(function: function))

let parts = unsafeBitCast(fn, to: UnsafePointer<ThickFunctionParts>.self)
let contextPointer = unsafeBitCast(parts.pointee.context, to: UInt.self)

reflect(instanceAddress: contextPointer, kind: .Object)

fn.deallocate(capacity: sizeof(ThickFunction1.self))
fn.deallocate(capacity: MemoryLayout<ThickFunction1>.size)
}

/// Reflect a closure context. The given function must be a Swift-native
/// @convention(thick) function value.
public func reflect(function: (Int, String) -> ()) {
let fn = UnsafeMutablePointer<ThickFunction2>.allocate(
capacity: sizeof(ThickFunction2.self))
capacity: MemoryLayout<ThickFunction2>.size)
fn.initialize(to: ThickFunction2(function: function))

let parts = unsafeBitCast(fn, to: UnsafePointer<ThickFunctionParts>.self)
let contextPointer = unsafeBitCast(parts.pointee.context, to: UInt.self)

reflect(instanceAddress: contextPointer, kind: .Object)

fn.deallocate(capacity: sizeof(ThickFunction2.self))
fn.deallocate(capacity: MemoryLayout<ThickFunction2>.size)
}

/// Reflect a closure context. The given function must be a Swift-native
/// @convention(thick) function value.
public func reflect(function: (Int, String, AnyObject?) -> ()) {
let fn = UnsafeMutablePointer<ThickFunction3>.allocate(
capacity: sizeof(ThickFunction3.self))
capacity: MemoryLayout<ThickFunction3>.size)
fn.initialize(to: ThickFunction3(function: function))

let parts = unsafeBitCast(fn, to: UnsafePointer<ThickFunctionParts>.self)
let contextPointer = unsafeBitCast(parts.pointee.context, to: UInt.self)

reflect(instanceAddress: contextPointer, kind: .Object)

fn.deallocate(capacity: sizeof(ThickFunction3.self))
fn.deallocate(capacity: MemoryLayout<ThickFunction3>.size)
}

/// Call this function to indicate to the parent that there are
Expand Down
12 changes: 6 additions & 6 deletions stdlib/public/SDK/CoreAudio/CoreAudio.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extension UnsafeBufferPointer {
/// Initialize an `UnsafeBufferPointer<Element>` from an `AudioBuffer`.
/// Binds the the buffer's memory type to `Element`.
public init(_ audioBuffer: AudioBuffer) {
let count = Int(audioBuffer.mDataByteSize) / strideof(Element.self)
let count = Int(audioBuffer.mDataByteSize) / MemoryLayout<Element>.stride
let elementPtr = audioBuffer.mData?.bindMemory(
to: Element.self, capacity: count)
self.init(start: elementPtr, count: count)
Expand All @@ -27,7 +27,7 @@ extension UnsafeMutableBufferPointer {
/// Initialize an `UnsafeMutableBufferPointer<Element>` from an
/// `AudioBuffer`.
public init(_ audioBuffer: AudioBuffer) {
let count = Int(audioBuffer.mDataByteSize) / strideof(Element.self)
let count = Int(audioBuffer.mDataByteSize) / MemoryLayout<Element>.stride
let elementPtr = audioBuffer.mData?.bindMemory(
to: Element.self, capacity: count)
self.init(start: elementPtr, count: count)
Expand All @@ -43,7 +43,7 @@ extension AudioBuffer {
) {
self.mNumberChannels = UInt32(numberOfChannels)
self.mData = UnsafeMutableRawPointer(typedBuffer.baseAddress)
self.mDataByteSize = UInt32(typedBuffer.count * strideof(Element.self))
self.mDataByteSize = UInt32(typedBuffer.count * MemoryLayout<Element>.stride)
}
}

Expand All @@ -53,8 +53,8 @@ extension AudioBufferList {
public static func sizeInBytes(maximumBuffers: Int) -> Int {
_precondition(maximumBuffers >= 1,
"AudioBufferList should contain at least one AudioBuffer")
return sizeof(AudioBufferList.self) +
(maximumBuffers - 1) * strideof(AudioBuffer.self)
return MemoryLayout<AudioBufferList>.size +
(maximumBuffers - 1) * MemoryLayout<AudioBuffer>.stride
}

/// Allocate an `AudioBufferList` with a capacity for the specified number of
Expand All @@ -72,7 +72,7 @@ extension AudioBufferList {
"failed to allocate memory for an AudioBufferList")

let listPtr = ablMemory!.bindMemory(to: AudioBufferList.self, capacity: 1)
(ablMemory! + strideof(AudioBufferList.self)).bindMemory(
(ablMemory! + MemoryLayout<AudioBufferList>.stride).bindMemory(
to: AudioBuffer.self, capacity: maximumBuffers)
let abl = UnsafeMutableAudioBufferListPointer(listPtr)
abl.count = maximumBuffers
Expand Down
12 changes: 6 additions & 6 deletions stdlib/public/SDK/Dispatch/Data.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public struct DispatchData : RandomAccessCollection, _ObjectiveCBridgeable {
var size = 0
let data = __dispatch_data_create_map(__wrapped, &ptr, &size)
let contentPtr = ptr!.bindMemory(
to: ContentType.self, capacity: size / strideof(ContentType.self))
to: ContentType.self, capacity: size / MemoryLayout<ContentType>.stride)
defer { _fixLifetime(data) }
return try body(contentPtr)
}
Expand Down Expand Up @@ -114,8 +114,8 @@ public struct DispatchData : RandomAccessCollection, _ObjectiveCBridgeable {
///
/// - parameter buffer: The buffer of bytes to append. The size is calculated from `SourceType` and `buffer.count`.
public mutating func append<SourceType>(_ buffer : UnsafeBufferPointer<SourceType>) {
buffer.baseAddress!.withMemoryRebound(to: UInt8.self, capacity: buffer.count * strideof(SourceType.self)) {
self.append($0, count: buffer.count * sizeof(SourceType.self))
buffer.baseAddress!.withMemoryRebound(to: UInt8.self, capacity: buffer.count * MemoryLayout<SourceType>.stride) {
self.append($0, count: buffer.count * MemoryLayout<SourceType>.stride)
Copy link
Member Author

@rintaro rintaro Jul 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gribozavr You didn't mention this sizeof -> stride change. This should be .size?
This was introduced in recent change.(https://github.com/apple/swift/blob/0b75ee975e55ffa7c8a69a0f076f33ff82b64f44/stdlib/public/SDK/Dispatch/Data.swift#L118) @atrick ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is supposed to be .stride on both modified lines.
I forgot to change the original code to strideof() and hadn't pushed my fix yet.

Copy link
Member Author

@rintaro rintaro Jul 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atrick
Thank you! If you have more fix, feel free to push them first.
I'd happy to rebase on it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't push my fix, it makes more sense as part of your PR. Thanks.

}
}

Expand Down Expand Up @@ -149,7 +149,7 @@ public struct DispatchData : RandomAccessCollection, _ObjectiveCBridgeable {

/// Copy the contents of the data into a buffer.
///
/// This function copies the bytes in `range` from the data into the buffer. If the count of the `range` is greater than `sizeof(DestinationType) * buffer.count` then the first N bytes will be copied into the buffer.
/// This function copies the bytes in `range` from the data into the buffer. If the count of the `range` is greater than `MemoryLayout<DestinationType>.size * buffer.count` then the first N bytes will be copied into the buffer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.stride. Please make this change as a separate commit so that it does not invalidate the CI results. (This is comment-only, so it does not matter for the purposes of CI.)

/// - precondition: The range must be within the bounds of the data. Otherwise `fatalError` is called.
/// - parameter buffer: A buffer to copy the data into.
/// - parameter range: A range in the data to copy into the buffer. If the range is empty, this function will return 0 without copying anything. If the range is nil, as much data as will fit into `buffer` is copied.
Expand All @@ -167,9 +167,9 @@ public struct DispatchData : RandomAccessCollection, _ObjectiveCBridgeable {
precondition(r.endIndex >= 0)
precondition(r.endIndex <= cnt, "The range is outside the bounds of the data")

copyRange = r.startIndex..<(r.startIndex + Swift.min(buffer.count * sizeof(DestinationType.self), r.count))
copyRange = r.startIndex..<(r.startIndex + Swift.min(buffer.count * MemoryLayout<DestinationType>.stride, r.count))
} else {
copyRange = 0..<Swift.min(buffer.count * sizeof(DestinationType.self), cnt)
copyRange = 0..<Swift.min(buffer.count * MemoryLayout<DestinationType>.stride, cnt)
}

guard !copyRange.isEmpty else { return 0 }
Expand Down
18 changes: 9 additions & 9 deletions stdlib/public/SDK/Foundation/Data.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
///
/// - parameter buffer: A buffer pointer to copy. The size is calculated from `SourceType` and `buffer.count`.
public init<SourceType>(buffer: UnsafeBufferPointer<SourceType>) {
_wrapped = _SwiftNSData(immutableObject: NSData(bytes: buffer.baseAddress, length: strideof(SourceType.self) * buffer.count))
_wrapped = _SwiftNSData(immutableObject: NSData(bytes: buffer.baseAddress, length: MemoryLayout<SourceType>.stride * buffer.count))
}

/// Initialize a `Data` with copied memory content.
///
/// - parameter buffer: A buffer pointer to copy. The size is calculated from `SourceType` and `buffer.count`.
public init<SourceType>(buffer: UnsafeMutableBufferPointer<SourceType>) {
_wrapped = _SwiftNSData(immutableObject: NSData(bytes: UnsafePointer(buffer.baseAddress), length: strideof(SourceType.self) * buffer.count))
_wrapped = _SwiftNSData(immutableObject: NSData(bytes: UnsafePointer(buffer.baseAddress), length: MemoryLayout<SourceType>.stride * buffer.count))
}

/// Initialize a `Data` with the contents of an Array.
Expand Down Expand Up @@ -281,7 +281,7 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
public func withUnsafeBytes<ResultType, ContentType>(_ body: @noescape (UnsafePointer<ContentType>) throws -> ResultType) rethrows -> ResultType {
let bytes = _getUnsafeBytesPointer()
defer { _fixLifetime(self)}
let contentPtr = bytes.bindMemory(to: ContentType.self, capacity: count / strideof(ContentType.self))
let contentPtr = bytes.bindMemory(to: ContentType.self, capacity: count / MemoryLayout<ContentType>.stride)
return try body(contentPtr)
}

Expand All @@ -298,7 +298,7 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
public mutating func withUnsafeMutableBytes<ResultType, ContentType>(_ body: @noescape (UnsafeMutablePointer<ContentType>) throws -> ResultType) rethrows -> ResultType {
let mutableBytes = _getUnsafeMutableBytesPointer()
defer { _fixLifetime(self)}
let contentPtr = mutableBytes.bindMemory(to: ContentType.self, capacity: count / strideof(ContentType.self))
let contentPtr = mutableBytes.bindMemory(to: ContentType.self, capacity: count / MemoryLayout<ContentType>.stride)
return try body(UnsafeMutablePointer(contentPtr))
}

Expand Down Expand Up @@ -329,7 +329,7 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl

/// Copy the contents of the data into a buffer.
///
/// This function copies the bytes in `range` from the data into the buffer. If the count of the `range` is greater than `strideof(DestinationType) * buffer.count` then the first N bytes will be copied into the buffer.
/// This function copies the bytes in `range` from the data into the buffer. If the count of the `range` is greater than `MemoryLayout<DestinationType>.stride * buffer.count` then the first N bytes will be copied into the buffer.
/// - precondition: The range must be within the bounds of the data. Otherwise `fatalError` is called.
/// - parameter buffer: A buffer to copy the data into.
/// - parameter range: A range in the data to copy into the buffer. If the range is empty, this function will return 0 without copying anything. If the range is nil, as much data as will fit into `buffer` is copied.
Expand All @@ -347,9 +347,9 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
precondition(r.upperBound >= 0)
precondition(r.upperBound <= cnt, "The range is outside the bounds of the data")

copyRange = r.lowerBound..<(r.lowerBound + Swift.min(buffer.count * strideof(DestinationType.self), r.count))
copyRange = r.lowerBound..<(r.lowerBound + Swift.min(buffer.count * MemoryLayout<DestinationType>.stride, r.count))
} else {
copyRange = 0..<Swift.min(buffer.count * strideof(DestinationType.self), cnt)
copyRange = 0..<Swift.min(buffer.count * MemoryLayout<DestinationType>.stride, cnt)
}

guard !copyRange.isEmpty else { return 0 }
Expand Down Expand Up @@ -458,7 +458,7 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
/// - parameter buffer: The buffer of bytes to append. The size is calculated from `SourceType` and `buffer.count`.
public mutating func append<SourceType>(_ buffer : UnsafeBufferPointer<SourceType>) {
_applyUnmanagedMutation {
$0.append(buffer.baseAddress!, length: buffer.count * strideof(SourceType.self))
$0.append(buffer.baseAddress!, length: buffer.count * MemoryLayout<SourceType>.stride)
}
}

Expand Down Expand Up @@ -502,7 +502,7 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
/// - parameter buffer: The replacement bytes.
public mutating func replaceSubrange<SourceType>(_ subrange: Range<Index>, with buffer: UnsafeBufferPointer<SourceType>) {
let nsRange = NSMakeRange(subrange.lowerBound, subrange.upperBound - subrange.lowerBound)
let bufferCount = buffer.count * strideof(SourceType.self)
let bufferCount = buffer.count * MemoryLayout<SourceType>.stride

_applyUnmanagedMutation {
$0.replaceBytes(in: nsRange, withBytes: buffer.baseAddress, length: bufferCount)
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/SDK/Foundation/DateInterval.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public struct DateInterval : ReferenceConvertible, Comparable, Hashable {
public var hashValue: Int {
var buf: (UInt, UInt) = (UInt(start.timeIntervalSinceReferenceDate), UInt(end.timeIntervalSinceReferenceDate))
return withUnsafeMutablePointer(to: &buf) {
return Int(bitPattern: CFHashBytes(unsafeBitCast($0, to: UnsafeMutablePointer<UInt8>.self), CFIndex(sizeof(UInt.self) * 2)))
return Int(bitPattern: CFHashBytes(unsafeBitCast($0, to: UnsafeMutablePointer<UInt8>.self), CFIndex(MemoryLayout<UInt>.size * 2)))
}
}

Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/SDK/Foundation/IndexPath.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public struct IndexPath : ReferenceConvertible, Equatable, Hashable, MutableColl
if count == 0 {
_indexes = []
} else {
var ptr = malloc(count * sizeof(Element.self))
var ptr = malloc(count * MemoryLayout<Element>.size)
defer { free(ptr) }

let elementPtr = ptr!.bindMemory(to: Element.self, capacity: count)
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/SDK/Foundation/UUID.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public struct UUID : ReferenceConvertible, Hashable, Equatable, CustomStringConv
public var hashValue: Int {
var localValue = uuid
return withUnsafeMutablePointer(to: &localValue) {
return Int(bitPattern: CFHashBytes(unsafeBitCast($0, to: UnsafeMutablePointer<UInt8>.self), CFIndex(sizeof(uuid_t.self))))
return Int(bitPattern: CFHashBytes(unsafeBitCast($0, to: UnsafeMutablePointer<UInt8>.self), CFIndex(MemoryLayout<uuid_t>.size)))
}
}

Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/SDK/GLKit/GLKit.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ vectorElementNames = [
public func _indexHomogeneousValue<TTT, T>(_ aggregate: UnsafePointer<TTT>,
_ index: Int) -> T {
return UnsafeRawPointer(aggregate).load(
fromByteOffset: index * strideof(T.self), as: T.self)
fromByteOffset: index * MemoryLayout<T>.stride, as: T.self)
}

%{
Expand Down
4 changes: 2 additions & 2 deletions stdlib/public/SDK/SceneKit/SceneKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ extension SCNGeometryElement {
fatalError("Expected constant number of indices per primitive")
}
self.init(
data: Data(bytes: indices, count: indexCount * sizeof(IndexType.self)),
data: Data(bytes: indices, count: indexCount * MemoryLayout<IndexType>.stride),
primitiveType: primitiveType,
primitiveCount: primitiveCount,
bytesPerIndex: sizeof(IndexType.self))
bytesPerIndex: MemoryLayout<IndexType>.stride)
_fixLifetime(indices)
}
}
Expand Down
4 changes: 2 additions & 2 deletions stdlib/public/core/BridgeObjectiveC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,8 @@ internal struct _CocoaFastEnumerationStackBuf {
_item14 = _item0
_item15 = _item0

_sanityCheck(sizeofValue(self) >=
sizeof(Optional<UnsafeRawPointer>.self) * count)
_sanityCheck(MemoryLayout._ofInstance(self).size >=
MemoryLayout<Optional<UnsafeRawPointer>>.size * count)
}
}

Expand Down
Loading