[stdlib] Still more nil buffer elimination

Swift SVN r22992
This commit is contained in:
Dave Abrahams
2014-10-28 18:00:55 +00:00
parent 8ced867315
commit f7bf9bf16d
4 changed files with 15 additions and 14 deletions

View File

@@ -190,9 +190,9 @@ public struct _ContiguousArrayBuffer<T> : _ArrayBufferType {
}
}
init(_ storage: _ContiguousArrayStorageBase?) {
init(_ storage: _ContiguousArrayStorageBase) {
__bufferPointer = ManagedBufferPointer(
unsafeBufferObject: storage ?? _emptyArrayStorage)
unsafeBufferObject: storage)
}
/// If the elements are stored contiguously, a pointer to the first
@@ -410,13 +410,11 @@ public struct _ContiguousArrayBuffer<T> : _ArrayBufferType {
// Start with the base class so that optimizations based on
// 'final' don't bypass dynamic type check.
let s: _ContiguousArrayStorageBase? = _storage
let s: _ContiguousArrayStorageBase = _storage
if _fastPath(s != nil){
if _fastPath(s!.staticElementType is U.Type) {
// Done in O(1)
return true
}
if _fastPath(s.staticElementType is U.Type) {
// Done in O(1)
return true
}
// Check the elements