Skip to content

Also apply @inlinable to AccelerateBuffer default implementations. #24655

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
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
10 changes: 6 additions & 4 deletions stdlib/public/Darwin/Accelerate/AccelerateBuffer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public protocol AccelerateBuffer {
/// Calls a closure with a pointer to the object's contiguous storage.
func withUnsafeBufferPointer<R>(
_ body: (UnsafeBufferPointer<Element>) throws -> R
) rethrows -> R
) rethrows -> R
}

/// A mutable object composed of count elements that are stored contiguously
Expand All @@ -40,23 +40,25 @@ public protocol AccelerateMutableBuffer: AccelerateBuffer {
/// contiguous storage.
mutating func withUnsafeMutableBufferPointer<R>(
_ body: (inout UnsafeMutableBufferPointer<Element>) throws -> R
) rethrows -> R
) rethrows -> R
}

@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
public extension AccelerateBuffer where Self: Collection {
@inlinable
func withUnsafeBufferPointer<R>(
_ body: (UnsafeBufferPointer<Element>) throws -> R
) rethrows -> R {
) rethrows -> R {
return try withContiguousStorageIfAvailable(body)!
}
}

@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
extension AccelerateMutableBuffer where Self: MutableCollection {
@inlinable
public mutating func withUnsafeMutableBufferPointer<R>(
_ body: (inout UnsafeMutableBufferPointer<Element>) throws -> R
) rethrows -> R {
) rethrows -> R {
return try withContiguousMutableStorageIfAvailable(body)!
}
}
Expand Down