File tree Expand file tree Collapse file tree 2 files changed +3
-12
lines changed Expand file tree Collapse file tree 2 files changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -290,18 +290,12 @@ extension MutableSpan where Element: ~Copyable {
290
290
@_alwaysEmitIntoClient
291
291
public subscript( _ position: Index ) -> Element {
292
292
unsafeAddress {
293
- _precondition (
294
- UInt ( bitPattern: position) < UInt ( bitPattern: _count) ,
295
- " Index out of bounds "
296
- )
293
+ _precondition ( indices. contains ( position) , " index out of bounds " )
297
294
return unsafe UnsafePointer( _unsafeAddressOfElement ( unchecked: position) )
298
295
}
299
296
@lifetime ( self : copy self )
300
297
unsafeMutableAddress {
301
- _precondition (
302
- UInt ( bitPattern: position) < UInt ( bitPattern: _count) ,
303
- " Index out of bounds "
304
- )
298
+ _precondition ( indices. contains ( position) , " index out of bounds " )
305
299
return unsafe _unsafeAddressOfElement( unchecked: position)
306
300
}
307
301
}
Original file line number Diff line number Diff line change @@ -419,10 +419,7 @@ extension Span where Element: ~Copyable {
419
419
@inline ( __always)
420
420
@_alwaysEmitIntoClient
421
421
internal func _checkIndex( _ position: Index ) {
422
- _precondition (
423
- UInt ( bitPattern: position) < UInt ( bitPattern: _count) ,
424
- " Index out of bounds "
425
- )
422
+ _precondition ( indices. contains ( position) , " Index out of bounds " )
426
423
}
427
424
428
425
/// Accesses the element at the specified position in the `Span`.
You can’t perform that action at this time.
0 commit comments