mirror of
https://github.com/apple/swift-collections
synced 2026-11-29 05:14:20 +00:00
Add _isIdentical, _extracting(first:)/_extracting(last:) as UnsafeBufferPointer extensions
This commit is contained in:
10 files changed
+510
-5
No files matched your search
@@ -27,6 +27,8 @@ target_sources(${module_name} PRIVATE
|
||||
"autogenerated/RandomAccessCollection+Offsets.swift"
|
||||
"autogenerated/UnsafeBufferPointer+Extras.swift"
|
||||
"autogenerated/UnsafeMutableBufferPointer+Extras.swift"
|
||||
"autogenerated/UnsafeRawBufferPointer+Extras.swift"
|
||||
"autogenerated/UnsafeMutableRawBufferPointer+Extras.swift"
|
||||
"IntegerTricks/autogenerated/FixedWidthInteger+roundUpToPowerOfTwo.swift"
|
||||
"IntegerTricks/autogenerated/Integer rank.swift"
|
||||
"IntegerTricks/autogenerated/UInt+first and last set bit.swift"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// This source file is part of the Swift Collections open source project
|
||||
//
|
||||
// Copyright (c) 2021 - 2024 Apple Inc. and the Swift project authors
|
||||
// Copyright (c) 2021 - 2025 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
@@ -24,5 +24,63 @@ extension UnsafeBufferPointer {
|
||||
return baseAddress.unsafelyUnwrapped + index
|
||||
}
|
||||
}
|
||||
|
||||
extension UnsafeBufferPointer where Element: ~Copyable {
|
||||
/// Returns a Boolean value indicating whether two `UnsafeBufferPointer`
|
||||
/// instances refer to the same region in memory.
|
||||
@inlinable @inline(__always)
|
||||
${modifier} func _isIdentical(to other: Self) -> Bool {
|
||||
(self.baseAddress == other.baseAddress) && (self.count == other.count)
|
||||
}
|
||||
}
|
||||
|
||||
extension UnsafeBufferPointer where Element: ~Copyable {
|
||||
/// Returns a buffer pointer containing the initial elements of this buffer,
|
||||
/// up to the specified maximum length.
|
||||
///
|
||||
/// If the maximum length exceeds the length of this buffer pointer,
|
||||
/// then the result contains all the elements.
|
||||
///
|
||||
/// The returned buffer's first item is always at offset 0; unlike buffer
|
||||
/// slices, extracted buffers do not share their indices with the
|
||||
/// buffer from which they are extracted.
|
||||
///
|
||||
/// - Parameter maxLength: The maximum number of elements to return.
|
||||
/// `maxLength` must be greater than or equal to zero.
|
||||
/// - Returns: A buffer pointer with at most `maxLength` elements.
|
||||
///
|
||||
/// - Complexity: O(1)
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public func _extracting(first maxLength: Int) -> Self {
|
||||
precondition(maxLength >= 0, "Can't have a prefix of negative length")
|
||||
let newCount = Swift.min(maxLength, count)
|
||||
return Self(start: baseAddress, count: newCount)
|
||||
}
|
||||
|
||||
/// Returns a buffer pointer containing the final elements of this buffer,
|
||||
/// up to the given maximum length.
|
||||
///
|
||||
/// If the maximum length exceeds the length of this buffer pointer,
|
||||
/// the result contains all the elements.
|
||||
///
|
||||
/// The returned buffer's first item is always at offset 0; unlike buffer
|
||||
/// slices, extracted buffers do not share their indices with the
|
||||
/// span from which they are extracted.
|
||||
///
|
||||
/// - Parameter maxLength: The maximum number of elements to return.
|
||||
/// `maxLength` must be greater than or equal to zero.
|
||||
/// - Returns: A buffer pointer with at most `maxLength` elements.
|
||||
///
|
||||
/// - Complexity: O(1)
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public func _extracting(last maxLength: Int) -> Self {
|
||||
precondition(maxLength >= 0, "Can't have a suffix of negative length")
|
||||
let newCount = Swift.min(maxLength, count)
|
||||
return extracting(Range(uncheckedBounds: (count - newCount, count)))
|
||||
}
|
||||
}
|
||||
% end
|
||||
${visibility_boilerplate("end")}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// This source file is part of the Swift Collections open source project
|
||||
//
|
||||
// Copyright (c) 2022 - 2024 Apple Inc. and the Swift project authors
|
||||
// Copyright (c) 2022 - 2025 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
@@ -16,6 +16,63 @@ ${autogenerated_warning()}
|
||||
|
||||
% for modifier in visibility_levels:
|
||||
${visibility_boilerplate(modifier)}
|
||||
extension UnsafeMutableBufferPointer where Element: ~Copyable {
|
||||
/// Returns a Boolean value indicating whether two
|
||||
/// `UnsafeMutableBufferPointer` instances refer to the same region in
|
||||
/// memory.
|
||||
@inlinable @inline(__always)
|
||||
${modifier} func _isIdentical(to other: Self) -> Bool {
|
||||
(self.baseAddress == other.baseAddress) && (self.count == other.count)
|
||||
}
|
||||
}
|
||||
|
||||
extension UnsafeMutableBufferPointer where Element: ~Copyable {
|
||||
/// Returns a buffer pointer containing the initial elements of this buffer,
|
||||
/// up to the specified maximum length.
|
||||
///
|
||||
/// If the maximum length exceeds the length of this buffer pointer,
|
||||
/// then the result contains all the elements.
|
||||
///
|
||||
/// The returned buffer's first item is always at offset 0; unlike buffer
|
||||
/// slices, extracted buffers do not share their indices with the
|
||||
/// buffer from which they are extracted.
|
||||
///
|
||||
/// - Parameter maxLength: The maximum number of elements to return.
|
||||
/// `maxLength` must be greater than or equal to zero.
|
||||
/// - Returns: A buffer pointer with at most `maxLength` elements.
|
||||
///
|
||||
/// - Complexity: O(1)
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public func _extracting(first maxLength: Int) -> Self {
|
||||
precondition(maxLength >= 0, "Can't have a prefix of negative length")
|
||||
let newCount = Swift.min(maxLength, count)
|
||||
return Self(start: baseAddress, count: newCount)
|
||||
}
|
||||
|
||||
/// Returns a buffer pointer containing the final elements of this buffer,
|
||||
/// up to the given maximum length.
|
||||
///
|
||||
/// If the maximum length exceeds the length of this buffer pointer,
|
||||
/// the result contains all the elements.
|
||||
///
|
||||
/// The returned buffer's first item is always at offset 0; unlike buffer
|
||||
/// slices, extracted buffers do not share their indices with the
|
||||
/// buffer from which they are extracted.
|
||||
///
|
||||
/// - Parameter maxLength: The maximum number of elements to return.
|
||||
/// `maxLength` must be greater than or equal to zero.
|
||||
/// - Returns: A buffer pointer with at most `maxLength` elements.
|
||||
///
|
||||
/// - Complexity: O(1)
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public func _extracting(last maxLength: Int) -> Self {
|
||||
precondition(maxLength >= 0, "Can't have a suffix of negative length")
|
||||
let newCount = Swift.min(maxLength, count)
|
||||
return extracting(Range(uncheckedBounds: (count - newCount, count)))
|
||||
}
|
||||
}
|
||||
extension UnsafeMutableBufferPointer {
|
||||
@inlinable
|
||||
${modifier} func initialize(fromContentsOf source: Self) -> Index {
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Collections open source project
|
||||
//
|
||||
// Copyright (c) 2025 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
%{
|
||||
from gyb_utils import *
|
||||
}%
|
||||
${autogenerated_warning()}
|
||||
|
||||
% for modifier in visibility_levels:
|
||||
${visibility_boilerplate(modifier)}
|
||||
extension UnsafeMutableRawBufferPointer {
|
||||
/// Returns a Boolean value indicating whether two
|
||||
/// `UnsafeMutableRawBufferPointer` instances refer to the same region in
|
||||
/// memory.
|
||||
@inlinable @inline(__always)
|
||||
${modifier} func _isIdentical(to other: Self) -> Bool {
|
||||
(self.baseAddress == other.baseAddress) && (self.count == other.count)
|
||||
}
|
||||
}
|
||||
% end
|
||||
${visibility_boilerplate("end")}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Collections open source project
|
||||
//
|
||||
// Copyright (c) 2025 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
%{
|
||||
from gyb_utils import *
|
||||
}%
|
||||
${autogenerated_warning()}
|
||||
|
||||
% for modifier in visibility_levels:
|
||||
${visibility_boilerplate(modifier)}
|
||||
extension UnsafeRawBufferPointer {
|
||||
/// Returns a Boolean value indicating whether two `UnsafeRawBufferPointer`
|
||||
/// instances refer to the same region in memory.
|
||||
@inlinable @inline(__always)
|
||||
${modifier} func _isIdentical(to other: Self) -> Bool {
|
||||
(self.baseAddress == other.baseAddress) && (self.count == other.count)
|
||||
}
|
||||
}
|
||||
% end
|
||||
${visibility_boilerplate("end")}
|
||||
|
||||
+116
-1
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// This source file is part of the Swift Collections open source project
|
||||
//
|
||||
// Copyright (c) 2021 - 2024 Apple Inc. and the Swift project authors
|
||||
// Copyright (c) 2021 - 2025 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
@@ -30,6 +30,63 @@ extension UnsafeBufferPointer {
|
||||
return baseAddress.unsafelyUnwrapped + index
|
||||
}
|
||||
}
|
||||
|
||||
extension UnsafeBufferPointer where Element: ~Copyable {
|
||||
/// Returns a Boolean value indicating whether two `UnsafeBufferPointer`
|
||||
/// instances refer to the same region in memory.
|
||||
@inlinable @inline(__always)
|
||||
internal func _isIdentical(to other: Self) -> Bool {
|
||||
(self.baseAddress == other.baseAddress) && (self.count == other.count)
|
||||
}
|
||||
}
|
||||
|
||||
extension UnsafeBufferPointer where Element: ~Copyable {
|
||||
/// Returns a buffer pointer containing the initial elements of this buffer,
|
||||
/// up to the specified maximum length.
|
||||
///
|
||||
/// If the maximum length exceeds the length of this buffer pointer,
|
||||
/// then the result contains all the elements.
|
||||
///
|
||||
/// The returned buffer's first item is always at offset 0; unlike buffer
|
||||
/// slices, extracted buffers do not share their indices with the
|
||||
/// buffer from which they are extracted.
|
||||
///
|
||||
/// - Parameter maxLength: The maximum number of elements to return.
|
||||
/// `maxLength` must be greater than or equal to zero.
|
||||
/// - Returns: A buffer pointer with at most `maxLength` elements.
|
||||
///
|
||||
/// - Complexity: O(1)
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public func _extracting(first maxLength: Int) -> Self {
|
||||
precondition(maxLength >= 0, "Can't have a prefix of negative length")
|
||||
let newCount = Swift.min(maxLength, count)
|
||||
return Self(start: baseAddress, count: newCount)
|
||||
}
|
||||
|
||||
/// Returns a buffer pointer containing the final elements of this buffer,
|
||||
/// up to the given maximum length.
|
||||
///
|
||||
/// If the maximum length exceeds the length of this buffer pointer,
|
||||
/// the result contains all the elements.
|
||||
///
|
||||
/// The returned buffer's first item is always at offset 0; unlike buffer
|
||||
/// slices, extracted buffers do not share their indices with the
|
||||
/// span from which they are extracted.
|
||||
///
|
||||
/// - Parameter maxLength: The maximum number of elements to return.
|
||||
/// `maxLength` must be greater than or equal to zero.
|
||||
/// - Returns: A buffer pointer with at most `maxLength` elements.
|
||||
///
|
||||
/// - Complexity: O(1)
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public func _extracting(last maxLength: Int) -> Self {
|
||||
precondition(maxLength >= 0, "Can't have a suffix of negative length")
|
||||
let newCount = Swift.min(maxLength, count)
|
||||
return extracting(Range(uncheckedBounds: (count - newCount, count)))
|
||||
}
|
||||
}
|
||||
#else // !COLLECTIONS_SINGLE_MODULE
|
||||
extension UnsafeBufferPointer {
|
||||
@inlinable
|
||||
@@ -39,4 +96,62 @@ extension UnsafeBufferPointer {
|
||||
return baseAddress.unsafelyUnwrapped + index
|
||||
}
|
||||
}
|
||||
|
||||
extension UnsafeBufferPointer where Element: ~Copyable {
|
||||
/// Returns a Boolean value indicating whether two `UnsafeBufferPointer`
|
||||
/// instances refer to the same region in memory.
|
||||
@inlinable @inline(__always)
|
||||
public func _isIdentical(to other: Self) -> Bool {
|
||||
(self.baseAddress == other.baseAddress) && (self.count == other.count)
|
||||
}
|
||||
}
|
||||
|
||||
extension UnsafeBufferPointer where Element: ~Copyable {
|
||||
/// Returns a buffer pointer containing the initial elements of this buffer,
|
||||
/// up to the specified maximum length.
|
||||
///
|
||||
/// If the maximum length exceeds the length of this buffer pointer,
|
||||
/// then the result contains all the elements.
|
||||
///
|
||||
/// The returned buffer's first item is always at offset 0; unlike buffer
|
||||
/// slices, extracted buffers do not share their indices with the
|
||||
/// buffer from which they are extracted.
|
||||
///
|
||||
/// - Parameter maxLength: The maximum number of elements to return.
|
||||
/// `maxLength` must be greater than or equal to zero.
|
||||
/// - Returns: A buffer pointer with at most `maxLength` elements.
|
||||
///
|
||||
/// - Complexity: O(1)
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public func _extracting(first maxLength: Int) -> Self {
|
||||
precondition(maxLength >= 0, "Can't have a prefix of negative length")
|
||||
let newCount = Swift.min(maxLength, count)
|
||||
return Self(start: baseAddress, count: newCount)
|
||||
}
|
||||
|
||||
/// Returns a buffer pointer containing the final elements of this buffer,
|
||||
/// up to the given maximum length.
|
||||
///
|
||||
/// If the maximum length exceeds the length of this buffer pointer,
|
||||
/// the result contains all the elements.
|
||||
///
|
||||
/// The returned buffer's first item is always at offset 0; unlike buffer
|
||||
/// slices, extracted buffers do not share their indices with the
|
||||
/// span from which they are extracted.
|
||||
///
|
||||
/// - Parameter maxLength: The maximum number of elements to return.
|
||||
/// `maxLength` must be greater than or equal to zero.
|
||||
/// - Returns: A buffer pointer with at most `maxLength` elements.
|
||||
///
|
||||
/// - Complexity: O(1)
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public func _extracting(last maxLength: Int) -> Self {
|
||||
precondition(maxLength >= 0, "Can't have a suffix of negative length")
|
||||
let newCount = Swift.min(maxLength, count)
|
||||
return extracting(Range(uncheckedBounds: (count - newCount, count)))
|
||||
}
|
||||
}
|
||||
#endif // COLLECTIONS_SINGLE_MODULE
|
||||
|
||||
+115
-1
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// This source file is part of the Swift Collections open source project
|
||||
//
|
||||
// Copyright (c) 2022 - 2024 Apple Inc. and the Swift project authors
|
||||
// Copyright (c) 2022 - 2025 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
@@ -22,6 +22,63 @@
|
||||
// but in regular builds we want them to be public. Unfortunately
|
||||
// the current best way to do this is to duplicate all definitions.
|
||||
#if COLLECTIONS_SINGLE_MODULE
|
||||
extension UnsafeMutableBufferPointer where Element: ~Copyable {
|
||||
/// Returns a Boolean value indicating whether two
|
||||
/// `UnsafeMutableBufferPointer` instances refer to the same region in
|
||||
/// memory.
|
||||
@inlinable @inline(__always)
|
||||
internal func _isIdentical(to other: Self) -> Bool {
|
||||
(self.baseAddress == other.baseAddress) && (self.count == other.count)
|
||||
}
|
||||
}
|
||||
|
||||
extension UnsafeMutableBufferPointer where Element: ~Copyable {
|
||||
/// Returns a buffer pointer containing the initial elements of this buffer,
|
||||
/// up to the specified maximum length.
|
||||
///
|
||||
/// If the maximum length exceeds the length of this buffer pointer,
|
||||
/// then the result contains all the elements.
|
||||
///
|
||||
/// The returned buffer's first item is always at offset 0; unlike buffer
|
||||
/// slices, extracted buffers do not share their indices with the
|
||||
/// buffer from which they are extracted.
|
||||
///
|
||||
/// - Parameter maxLength: The maximum number of elements to return.
|
||||
/// `maxLength` must be greater than or equal to zero.
|
||||
/// - Returns: A buffer pointer with at most `maxLength` elements.
|
||||
///
|
||||
/// - Complexity: O(1)
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public func _extracting(first maxLength: Int) -> Self {
|
||||
precondition(maxLength >= 0, "Can't have a prefix of negative length")
|
||||
let newCount = Swift.min(maxLength, count)
|
||||
return Self(start: baseAddress, count: newCount)
|
||||
}
|
||||
|
||||
/// Returns a buffer pointer containing the final elements of this buffer,
|
||||
/// up to the given maximum length.
|
||||
///
|
||||
/// If the maximum length exceeds the length of this buffer pointer,
|
||||
/// the result contains all the elements.
|
||||
///
|
||||
/// The returned buffer's first item is always at offset 0; unlike buffer
|
||||
/// slices, extracted buffers do not share their indices with the
|
||||
/// buffer from which they are extracted.
|
||||
///
|
||||
/// - Parameter maxLength: The maximum number of elements to return.
|
||||
/// `maxLength` must be greater than or equal to zero.
|
||||
/// - Returns: A buffer pointer with at most `maxLength` elements.
|
||||
///
|
||||
/// - Complexity: O(1)
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public func _extracting(last maxLength: Int) -> Self {
|
||||
precondition(maxLength >= 0, "Can't have a suffix of negative length")
|
||||
let newCount = Swift.min(maxLength, count)
|
||||
return extracting(Range(uncheckedBounds: (count - newCount, count)))
|
||||
}
|
||||
}
|
||||
extension UnsafeMutableBufferPointer {
|
||||
@inlinable
|
||||
internal func initialize(fromContentsOf source: Self) -> Index {
|
||||
@@ -149,6 +206,63 @@ extension Slice {
|
||||
}
|
||||
}
|
||||
#else // !COLLECTIONS_SINGLE_MODULE
|
||||
extension UnsafeMutableBufferPointer where Element: ~Copyable {
|
||||
/// Returns a Boolean value indicating whether two
|
||||
/// `UnsafeMutableBufferPointer` instances refer to the same region in
|
||||
/// memory.
|
||||
@inlinable @inline(__always)
|
||||
public func _isIdentical(to other: Self) -> Bool {
|
||||
(self.baseAddress == other.baseAddress) && (self.count == other.count)
|
||||
}
|
||||
}
|
||||
|
||||
extension UnsafeMutableBufferPointer where Element: ~Copyable {
|
||||
/// Returns a buffer pointer containing the initial elements of this buffer,
|
||||
/// up to the specified maximum length.
|
||||
///
|
||||
/// If the maximum length exceeds the length of this buffer pointer,
|
||||
/// then the result contains all the elements.
|
||||
///
|
||||
/// The returned buffer's first item is always at offset 0; unlike buffer
|
||||
/// slices, extracted buffers do not share their indices with the
|
||||
/// buffer from which they are extracted.
|
||||
///
|
||||
/// - Parameter maxLength: The maximum number of elements to return.
|
||||
/// `maxLength` must be greater than or equal to zero.
|
||||
/// - Returns: A buffer pointer with at most `maxLength` elements.
|
||||
///
|
||||
/// - Complexity: O(1)
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public func _extracting(first maxLength: Int) -> Self {
|
||||
precondition(maxLength >= 0, "Can't have a prefix of negative length")
|
||||
let newCount = Swift.min(maxLength, count)
|
||||
return Self(start: baseAddress, count: newCount)
|
||||
}
|
||||
|
||||
/// Returns a buffer pointer containing the final elements of this buffer,
|
||||
/// up to the given maximum length.
|
||||
///
|
||||
/// If the maximum length exceeds the length of this buffer pointer,
|
||||
/// the result contains all the elements.
|
||||
///
|
||||
/// The returned buffer's first item is always at offset 0; unlike buffer
|
||||
/// slices, extracted buffers do not share their indices with the
|
||||
/// buffer from which they are extracted.
|
||||
///
|
||||
/// - Parameter maxLength: The maximum number of elements to return.
|
||||
/// `maxLength` must be greater than or equal to zero.
|
||||
/// - Returns: A buffer pointer with at most `maxLength` elements.
|
||||
///
|
||||
/// - Complexity: O(1)
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public func _extracting(last maxLength: Int) -> Self {
|
||||
precondition(maxLength >= 0, "Can't have a suffix of negative length")
|
||||
let newCount = Swift.min(maxLength, count)
|
||||
return extracting(Range(uncheckedBounds: (count - newCount, count)))
|
||||
}
|
||||
}
|
||||
extension UnsafeMutableBufferPointer {
|
||||
@inlinable
|
||||
public func initialize(fromContentsOf source: Self) -> Index {
|
||||
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Collections open source project
|
||||
//
|
||||
// Copyright (c) 2025 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
||||
// #############################################################################
|
||||
// # #
|
||||
// # DO NOT EDIT THIS FILE; IT IS AUTOGENERATED. #
|
||||
// # #
|
||||
// #############################################################################
|
||||
|
||||
|
||||
|
||||
// In single module mode, we need these declarations to be internal,
|
||||
// but in regular builds we want them to be public. Unfortunately
|
||||
// the current best way to do this is to duplicate all definitions.
|
||||
#if COLLECTIONS_SINGLE_MODULE
|
||||
extension UnsafeMutableRawBufferPointer {
|
||||
/// Returns a Boolean value indicating whether two
|
||||
/// `UnsafeMutableRawBufferPointer` instances refer to the same region in
|
||||
/// memory.
|
||||
@inlinable @inline(__always)
|
||||
internal func _isIdentical(to other: Self) -> Bool {
|
||||
(self.baseAddress == other.baseAddress) && (self.count == other.count)
|
||||
}
|
||||
}
|
||||
#else // !COLLECTIONS_SINGLE_MODULE
|
||||
extension UnsafeMutableRawBufferPointer {
|
||||
/// Returns a Boolean value indicating whether two
|
||||
/// `UnsafeMutableRawBufferPointer` instances refer to the same region in
|
||||
/// memory.
|
||||
@inlinable @inline(__always)
|
||||
public func _isIdentical(to other: Self) -> Bool {
|
||||
(self.baseAddress == other.baseAddress) && (self.count == other.count)
|
||||
}
|
||||
}
|
||||
#endif // COLLECTIONS_SINGLE_MODULE
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Collections open source project
|
||||
//
|
||||
// Copyright (c) 2025 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
||||
// #############################################################################
|
||||
// # #
|
||||
// # DO NOT EDIT THIS FILE; IT IS AUTOGENERATED. #
|
||||
// # #
|
||||
// #############################################################################
|
||||
|
||||
|
||||
|
||||
// In single module mode, we need these declarations to be internal,
|
||||
// but in regular builds we want them to be public. Unfortunately
|
||||
// the current best way to do this is to duplicate all definitions.
|
||||
#if COLLECTIONS_SINGLE_MODULE
|
||||
extension UnsafeRawBufferPointer {
|
||||
/// Returns a Boolean value indicating whether two `UnsafeRawBufferPointer`
|
||||
/// instances refer to the same region in memory.
|
||||
@inlinable @inline(__always)
|
||||
internal func _isIdentical(to other: Self) -> Bool {
|
||||
(self.baseAddress == other.baseAddress) && (self.count == other.count)
|
||||
}
|
||||
}
|
||||
#else // !COLLECTIONS_SINGLE_MODULE
|
||||
extension UnsafeRawBufferPointer {
|
||||
/// Returns a Boolean value indicating whether two `UnsafeRawBufferPointer`
|
||||
/// instances refer to the same region in memory.
|
||||
@inlinable @inline(__always)
|
||||
public func _isIdentical(to other: Self) -> Bool {
|
||||
(self.baseAddress == other.baseAddress) && (self.count == other.count)
|
||||
}
|
||||
}
|
||||
#endif // COLLECTIONS_SINGLE_MODULE
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
7D48BCDC2E51554900D7F6F7 /* ClassBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D48BCDB2E51554900D7F6F7 /* ClassBox.swift */; };
|
||||
7D48BCE02E51558700D7F6F7 /* LifetimeTrackedStruct.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D48BCDE2E51558700D7F6F7 /* LifetimeTrackedStruct.swift */; };
|
||||
7D48BCEE2E5158A100D7F6F7 /* BoxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D48BCE62E5158A100D7F6F7 /* BoxTests.swift */; };
|
||||
7D48BCFE2E5182CE00D7F6F7 /* UnsafeRawBufferPointer+Extras.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D48BCFD2E5182CE00D7F6F7 /* UnsafeRawBufferPointer+Extras.swift */; };
|
||||
7D48BCFF2E5182CE00D7F6F7 /* UnsafeMutableRawBufferPointer+Extras.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D48BCFC2E5182CE00D7F6F7 /* UnsafeMutableRawBufferPointer+Extras.swift */; };
|
||||
7D48BD002E5182CE00D7F6F7 /* LifetimeOverride.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D48BCFA2E5182CE00D7F6F7 /* LifetimeOverride.swift */; };
|
||||
7D9B859729E4F74400B291CD /* BitArray+Shifts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D9B859129E4F74400B291CD /* BitArray+Shifts.swift */; };
|
||||
7D9B859829E4F74400B291CD /* BitArray+Descriptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D9B859229E4F74400B291CD /* BitArray+Descriptions.swift */; };
|
||||
@@ -436,7 +438,11 @@
|
||||
7D48BCE62E5158A100D7F6F7 /* BoxTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoxTests.swift; sourceTree = "<group>"; };
|
||||
7D48BCF52E51651900D7F6F7 /* Package@swift-6.0.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "Package@swift-6.0.swift"; path = "../Package@swift-6.0.swift"; sourceTree = SOURCE_ROOT; };
|
||||
7D48BCF62E5172CF00D7F6F7 /* LifetimeOverride.swift.gyb */ = {isa = PBXFileReference; lastKnownFileType = text; path = LifetimeOverride.swift.gyb; sourceTree = "<group>"; };
|
||||
7D48BCF82E5172CF00D7F6F7 /* UnsafeMutableRawBufferPointer+Extras.swift.gyb */ = {isa = PBXFileReference; lastKnownFileType = text; path = "UnsafeMutableRawBufferPointer+Extras.swift.gyb"; sourceTree = "<group>"; };
|
||||
7D48BCF92E5172CF00D7F6F7 /* UnsafeRawBufferPointer+Extras.swift.gyb */ = {isa = PBXFileReference; lastKnownFileType = text; path = "UnsafeRawBufferPointer+Extras.swift.gyb"; sourceTree = "<group>"; };
|
||||
7D48BCFA2E5182CE00D7F6F7 /* LifetimeOverride.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LifetimeOverride.swift; sourceTree = "<group>"; };
|
||||
7D48BCFC2E5182CE00D7F6F7 /* UnsafeMutableRawBufferPointer+Extras.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UnsafeMutableRawBufferPointer+Extras.swift"; sourceTree = "<group>"; };
|
||||
7D48BCFD2E5182CE00D7F6F7 /* UnsafeRawBufferPointer+Extras.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UnsafeRawBufferPointer+Extras.swift"; sourceTree = "<group>"; };
|
||||
7D5A64D229CCE8CC00CB2595 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
|
||||
7D5A64D329CCEE9A00CB2595 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
|
||||
7D5A64D429CCEF1500CB2595 /* generate-sources.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "generate-sources.sh"; sourceTree = "<group>"; };
|
||||
@@ -1264,6 +1270,7 @@
|
||||
7DEBDAD329CBEE5300ADC226 /* autogenerated */,
|
||||
7DEBDAE229CBEE5300ADC226 /* IntegerTricks */,
|
||||
7DEBDADA29CBEE5300ADC226 /* UnsafeBitSet */,
|
||||
7DE91F2E29CA70F3004483EB /* CMakeLists.txt */,
|
||||
7DE91F3029CA70F3004483EB /* _SortedCollection.swift */,
|
||||
7DE91F3829CA70F3004483EB /* _UniqueCollection.swift */,
|
||||
7DEBDAED29CBEE5300ADC226 /* Debugging.swift.gyb */,
|
||||
@@ -1272,7 +1279,8 @@
|
||||
7DEBDAD229CBEE5200ADC226 /* RandomAccessCollection+Offsets.swift.gyb */,
|
||||
7DEBDAD929CBEE5300ADC226 /* UnsafeBufferPointer+Extras.swift.gyb */,
|
||||
7DEBDAEC29CBEE5300ADC226 /* UnsafeMutableBufferPointer+Extras.swift.gyb */,
|
||||
7DE91F2E29CA70F3004483EB /* CMakeLists.txt */,
|
||||
7D48BCF82E5172CF00D7F6F7 /* UnsafeMutableRawBufferPointer+Extras.swift.gyb */,
|
||||
7D48BCF92E5172CF00D7F6F7 /* UnsafeRawBufferPointer+Extras.swift.gyb */,
|
||||
);
|
||||
path = InternalCollectionsUtilities;
|
||||
sourceTree = "<group>";
|
||||
@@ -1665,6 +1673,8 @@
|
||||
7DEBDAD629CBEE5300ADC226 /* RandomAccessCollection+Offsets.swift */,
|
||||
7DEBDAD529CBEE5300ADC226 /* UnsafeBufferPointer+Extras.swift */,
|
||||
7DEBDAD429CBEE5300ADC226 /* UnsafeMutableBufferPointer+Extras.swift */,
|
||||
7D48BCFC2E5182CE00D7F6F7 /* UnsafeMutableRawBufferPointer+Extras.swift */,
|
||||
7D48BCFD2E5182CE00D7F6F7 /* UnsafeRawBufferPointer+Extras.swift */,
|
||||
);
|
||||
path = autogenerated;
|
||||
sourceTree = "<group>";
|
||||
@@ -2113,6 +2123,8 @@
|
||||
7DE9213D29CA70F4004483EB /* TreeSet+SetAlgebra isSubset.swift in Sources */,
|
||||
7DE9203029CA70F3004483EB /* OrderedSet+SubSequence.swift in Sources */,
|
||||
7DE9215529CA70F4004483EB /* _RawHashNode+UnsafeHandle.swift in Sources */,
|
||||
7D48BCFE2E5182CE00D7F6F7 /* UnsafeRawBufferPointer+Extras.swift in Sources */,
|
||||
7D48BCFF2E5182CE00D7F6F7 /* UnsafeMutableRawBufferPointer+Extras.swift in Sources */,
|
||||
7D48BD002E5182CE00D7F6F7 /* LifetimeOverride.swift in Sources */,
|
||||
7DE9209429CA70F4004483EB /* Rope+_UnmanagedLeaf.swift in Sources */,
|
||||
7DE9208429CA70F4004483EB /* BigString+Equatable.swift in Sources */,
|
||||
|
||||
Reference in new issue
Block a user