Skip to content

Commit 0968d16

Browse files
authored
Merge pull request #31868 from meg-gupta/endindex
[stdlib] Make non-native ArrayBuffer.capacity smaller
2 parents e055b4b + 0a77ce3 commit 0968d16

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

stdlib/public/core/ArrayBuffer.swift

Lines changed: 1 addition & 2 deletions
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
@@ -510,7 +510,6 @@ extension _ArrayBuffer {
510510

511511
@inlinable
512512
internal var _nonNative: _CocoaArrayWrapper {
513-
@inline(__always)
514513
get {
515514
_internalInvariant(_isClassOrObjCExistential(Element.self))
516515
return _CocoaArrayWrapper(_storage.objCInstance)

0 commit comments

Comments
 (0)