[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:
Dave Abrahams
2014-10-15 20:27:57 +00:00
parent 543f6b3a9a
commit 4bdb9462c7
6 changed files with 31 additions and 24 deletions

View File

@@ -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