@@ -99,7 +99,12 @@ extension _ValidUTF8Buffer : Collection {
99
99
public var count : Int {
100
100
return Storage . bitWidth &>> 3 &- _biasedBits. leadingZeroBitCount &>> 3
101
101
}
102
-
102
+
103
+ @_inlineable // FIXME(sil-serialize-all)
104
+ public var isEmpty : Bool {
105
+ return _biasedBits == 0
106
+ }
107
+
103
108
@_inlineable // FIXME(sil-serialize-all)
104
109
public func index( after i: Index ) -> Index {
105
110
_debugPrecondition ( i. _biasedBits != 0 )
@@ -122,7 +127,7 @@ extension _ValidUTF8Buffer : BidirectionalCollection {
122
127
}
123
128
124
129
extension _ValidUTF8Buffer : RandomAccessCollection {
125
- public typealias Indices = DefaultRandomAccessIndices < _ValidUTF8Buffer >
130
+ public typealias Indices = DefaultIndices < _ValidUTF8Buffer >
126
131
127
132
@_inlineable // FIXME(sil-serialize-all)
128
133
@inline ( __always)
@@ -172,9 +177,12 @@ extension _ValidUTF8Buffer : RangeReplaceableCollection {
172
177
173
178
@_inlineable // FIXME(sil-serialize-all)
174
179
@inline ( __always)
175
- public mutating func removeFirst( ) {
180
+ @discardableResult
181
+ public mutating func removeFirst( ) -> Element {
176
182
_debugPrecondition ( !isEmpty)
183
+ let result = Element ( truncatingIfNeeded: _biasedBits) &- 1
177
184
_biasedBits = _biasedBits. _fullShiftRight ( 8 )
185
+ return result
178
186
}
179
187
180
188
@_inlineable // FIXME(sil-serialize-all)
@@ -196,7 +204,9 @@ extension _ValidUTF8Buffer : RangeReplaceableCollection {
196
204
for x in self [ target. upperBound... ] { r. append ( x) }
197
205
self = r
198
206
}
207
+ }
199
208
209
+ extension _ValidUTF8Buffer {
200
210
@_inlineable // FIXME(sil-serialize-all)
201
211
@inline ( __always)
202
212
public mutating func append< T> ( contentsOf other: _ValidUTF8Buffer < T > ) {
0 commit comments