Skip to content

Commit a461a48

Browse files
committed
stdlib: Make non-native ArrayBuffer.capacity smaller
Similar to swiftlang#28486 in motivation. Before this change 'count' got lowered to multiple 'endIndex' calls Fixes rdar://46702232
1 parent 7e00f7e commit a461a48

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stdlib/public/core/ArrayBuffer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ extension _ArrayBuffer {
315315
/// The number of elements the buffer can store without reallocation.
316316
@inlinable
317317
internal var capacity: Int {
318-
return _fastPath(_isNative) ? _native.capacity : _nonNative.count
318+
return _fastPath(_isNative) ? _native.capacity : _nonNative.endIndex
319319
}
320320

321321
@inlinable

0 commit comments

Comments
 (0)