@@ -1982,43 +1982,37 @@ internal struct _IgnorePointer<T> : _PointerFunction {
1982
1982
}
1983
1983
}
1984
1984
1985
- @_versioned
1986
- @inline ( never)
1987
- internal func _outlinedMakeUniqueBuffer< _Buffer> (
1988
- _ buffer: inout _Buffer , bufferCount: Int
1989
- ) where
1990
- _Buffer : _ArrayBufferProtocol ,
1991
- _Buffer. Index == Int {
1985
+ extension _ArrayBufferProtocol where Index == Int {
1986
+ @_versioned
1987
+ @inline ( never)
1988
+ internal func _outlinedMakeUniqueBuffer( bufferCount: Int ) {
1992
1989
1993
- if _fastPath (
1994
- buffer. requestUniqueMutableBackingBuffer ( minimumCapacity: bufferCount) != nil ) {
1995
- return
1990
+ if _fastPath (
1991
+ requestUniqueMutableBackingBuffer ( minimumCapacity: bufferCount) != nil ) {
1992
+ return
1993
+ }
1994
+
1995
+ var newBuffer = _forceCreateUniqueMutableBuffer (
1996
+ newCount: bufferCount, requiredCapacity: bufferCount)
1997
+ _arrayOutOfPlaceUpdate ( & newBuffer, bufferCount, 0 , _IgnorePointer ( ) )
1996
1998
}
1997
1999
1998
- var newBuffer = buffer. _forceCreateUniqueMutableBuffer (
1999
- newCount: bufferCount, requiredCapacity: bufferCount)
2000
- buffer. _arrayOutOfPlaceUpdate ( & newBuffer, bufferCount, 0 , _IgnorePointer ( ) )
2001
- }
2000
+ internal func _arrayReserve( _ minimumCapacity: Int ) {
2002
2001
2003
- internal func _arrayReserve< _Buffer> (
2004
- _ buffer: inout _Buffer , _ minimumCapacity: Int
2005
- ) where
2006
- _Buffer : _ArrayBufferProtocol ,
2007
- _Buffer. Index == Int {
2002
+ let count = self . count
2003
+ let requiredCapacity = max ( count, minimumCapacity)
2008
2004
2009
- let count = buffer. count
2010
- let requiredCapacity = max ( count, minimumCapacity)
2005
+ if _fastPath (
2006
+ buffer. requestUniqueMutableBackingBuffer (
2007
+ minimumCapacity: requiredCapacity) != nil
2008
+ ) {
2009
+ return
2010
+ }
2011
2011
2012
- if _fastPath (
2013
- buffer. requestUniqueMutableBackingBuffer (
2014
- minimumCapacity: requiredCapacity) != nil
2015
- ) {
2016
- return
2012
+ var newBuffer = _forceCreateUniqueMutableBuffer (
2013
+ newCount: count, requiredCapacity: requiredCapacity)
2014
+ _arrayOutOfPlaceUpdate ( & newBuffer, count, 0 , _IgnorePointer ( ) )
2017
2015
}
2018
-
2019
- var newBuffer = buffer. _forceCreateUniqueMutableBuffer (
2020
- newCount: count, requiredCapacity: requiredCapacity)
2021
- buffer. _arrayOutOfPlaceUpdate ( & newBuffer, count, 0 , _IgnorePointer ( ) )
2022
2016
}
2023
2017
2024
2018
/// Append items from `newItems` to `buffer`.
0 commit comments