mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[stdlib] ArrayBufferType: identity is base address
Buffer identity is only used by tests. The switch to an identity representation that accounts for the buffer length was actually incorrect for the way many tests used it. Swift SVN r22771
This commit is contained in:
@@ -399,11 +399,11 @@ public struct _ContiguousArrayBuffer<T> : _ArrayBufferType {
|
||||
return _storage
|
||||
}
|
||||
|
||||
/// A value that identifies the exact elements covered by the buffer
|
||||
public var identity: Range<UnsafePointer<UInt8>> {
|
||||
return withUnsafeBufferPointer {
|
||||
UnsafePointer($0.baseAddress)..<UnsafePointer($0.baseAddress + self.count)
|
||||
}
|
||||
/// A value that identifies the storage used by the buffer. Two
|
||||
/// buffers address the same elements when they have the same
|
||||
/// identity and count.
|
||||
public var identity: UnsafePointer<Void> {
|
||||
return withUnsafeBufferPointer { UnsafePointer($0.baseAddress) }
|
||||
}
|
||||
|
||||
/// Return true iff we have storage for elements of the given
|
||||
|
||||
Reference in New Issue
Block a user