@@ -58,7 +58,7 @@ extension MutableSpan where Element: ~Copyable {
58
58
public init (
59
59
_unsafeElements buffer: UnsafeMutableBufferPointer < Element >
60
60
) {
61
- precondition (
61
+ _precondition (
62
62
( ( Int ( bitPattern: buffer. baseAddress) &
63
63
( MemoryLayout < Element > . alignment&- 1 ) ) == 0 ) ,
64
64
" baseAddress must be properly aligned to access Element "
@@ -73,7 +73,7 @@ extension MutableSpan where Element: ~Copyable {
73
73
_unsafeStart start: UnsafeMutablePointer < Element > ,
74
74
count: Int
75
75
) {
76
- precondition ( count >= 0 , " Count must not be negative " )
76
+ _precondition ( count >= 0 , " Count must not be negative " )
77
77
let buffer = UnsafeMutableBufferPointer ( start: start, count: count)
78
78
let ms = MutableSpan ( _unsafeElements: buffer)
79
79
self = _overrideLifetime ( ms, borrowing: start)
@@ -102,14 +102,14 @@ extension MutableSpan where Element: BitwiseCopyable {
102
102
public init (
103
103
_unsafeBytes buffer: UnsafeMutableRawBufferPointer
104
104
) {
105
- precondition (
105
+ _precondition (
106
106
( ( Int ( bitPattern: buffer. baseAddress) &
107
107
( MemoryLayout < Element > . alignment&- 1 ) ) == 0 ) ,
108
108
" baseAddress must be properly aligned to access Element "
109
109
)
110
110
let ( byteCount, stride) = ( buffer. count, MemoryLayout< Element> . stride)
111
111
let ( count, remainder) = byteCount. quotientAndRemainder ( dividingBy: stride)
112
- precondition ( remainder == 0 , " Span must contain a whole number of elements " )
112
+ _precondition ( remainder == 0 , " Span must contain a whole number of elements " )
113
113
let elements = UnsafeMutableBufferPointer < Element > (
114
114
start: buffer. baseAddress? . assumingMemoryBound ( to: Element . self) ,
115
115
count: count
@@ -124,7 +124,7 @@ extension MutableSpan where Element: BitwiseCopyable {
124
124
_unsafeStart pointer: UnsafeMutableRawPointer ,
125
125
byteCount: Int
126
126
) {
127
- precondition ( byteCount >= 0 , " Count must not be negative " )
127
+ _precondition ( byteCount >= 0 , " Count must not be negative " )
128
128
let bytes = UnsafeMutableRawBufferPointer ( start: pointer, count: byteCount)
129
129
let ms = MutableSpan ( _unsafeBytes: bytes)
130
130
self = _overrideLifetime ( ms, borrowing: pointer)
@@ -229,7 +229,7 @@ extension MutableSpan where Element: ~Copyable & ~Escapable {
229
229
230
230
@_alwaysEmitIntoClient
231
231
public var indices : Range < Index > {
232
- Range ( uncheckedBounds : ( 0 , _count) )
232
+ Range ( _uncheckedBounds : ( 0 , _count) )
233
233
}
234
234
}
235
235
@@ -260,11 +260,11 @@ extension MutableSpan where Element: ~Copyable {
260
260
@_alwaysEmitIntoClient
261
261
public subscript( _ position: Index ) -> Element {
262
262
unsafeAddress {
263
- precondition ( indices. contains ( position) , " index out of bounds " )
263
+ _precondition ( indices. contains ( position) , " index out of bounds " )
264
264
return UnsafePointer ( _unsafeAddressOfElement ( unchecked: position) )
265
265
}
266
266
unsafeMutableAddress {
267
- precondition ( indices. contains ( position) , " index out of bounds " )
267
+ _precondition ( indices. contains ( position) , " index out of bounds " )
268
268
return _unsafeAddressOfElement ( unchecked: position)
269
269
}
270
270
}
@@ -303,8 +303,8 @@ extension MutableSpan where Element: ~Copyable {
303
303
304
304
@_alwaysEmitIntoClient
305
305
public mutating func swapAt( _ i: Index , _ j: Index ) {
306
- precondition ( indices. contains ( Index ( i) ) )
307
- precondition ( indices. contains ( Index ( j) ) )
306
+ _precondition ( indices. contains ( Index ( i) ) )
307
+ _precondition ( indices. contains ( Index ( j) ) )
308
308
swapAt ( unchecked: i, unchecked: j)
309
309
}
310
310
@@ -330,11 +330,11 @@ extension MutableSpan where Element: BitwiseCopyable {
330
330
@_alwaysEmitIntoClient
331
331
public subscript( _ position: Index ) -> Element {
332
332
get {
333
- precondition ( indices. contains ( position) , " index out of bounds " )
333
+ _precondition ( indices. contains ( position) , " index out of bounds " )
334
334
return self [ unchecked: position]
335
335
}
336
336
set {
337
- precondition ( indices. contains ( position) , " index out of bounds " )
337
+ _precondition ( indices. contains ( position) , " index out of bounds " )
338
338
self [ unchecked: position] = newValue
339
339
}
340
340
}
@@ -460,7 +460,7 @@ extension MutableSpan {
460
460
461
461
var iterator = source. makeIterator ( )
462
462
let index = update ( from: & iterator)
463
- precondition (
463
+ _precondition (
464
464
iterator. next ( ) == nil ,
465
465
" destination buffer view cannot contain every element from source. "
466
466
)
@@ -470,7 +470,7 @@ extension MutableSpan {
470
470
@_alwaysEmitIntoClient
471
471
public mutating func update( fromContentsOf source: Span < Element > ) -> Index {
472
472
guard !source. isEmpty else { return 0 }
473
- precondition (
473
+ _precondition (
474
474
source. count <= self . count,
475
475
" destination span cannot contain every element from source. "
476
476
)
@@ -498,7 +498,7 @@ extension MutableSpan where Element: ~Copyable {
498
498
// fromContentsOf source: consuming OutputSpan<Element>
499
499
// ) -> Index {
500
500
// guard !source.isEmpty else { return 0 }
501
- // precondition (
501
+ // _precondition (
502
502
// source.count <= self.count,
503
503
// "destination span cannot contain every element from source."
504
504
// )
@@ -586,7 +586,7 @@ extension MutableSpan where Element: BitwiseCopyable {
586
586
587
587
var iterator = source. makeIterator ( )
588
588
let index = update ( from: & iterator)
589
- precondition (
589
+ _precondition (
590
590
iterator. next ( ) == nil ,
591
591
" destination buffer view cannot contain every element from source. "
592
592
)
@@ -598,7 +598,7 @@ extension MutableSpan where Element: BitwiseCopyable {
598
598
fromContentsOf source: Span < Element >
599
599
) -> Index where Element: BitwiseCopyable {
600
600
guard !source. isEmpty else { return 0 }
601
- precondition (
601
+ _precondition (
602
602
source. count <= self . count,
603
603
" destination span cannot contain every element from source. "
604
604
)
0 commit comments