Skip to content

Commit fc9e574

Browse files
committed
[stdlib] small spelling fixes
1 parent 8e4a8bb commit fc9e574

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

stdlib/public/core/Span/MutableRawSpan.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ public struct MutableRawSpan: ~Copyable & ~Escapable {
3030
@lifetime(borrow pointer)
3131
internal init(
3232
_unchecked pointer: UnsafeMutableRawPointer?,
33-
count: Int
33+
byteCount: Int
3434
) {
3535
_pointer = pointer
36-
_count = count
36+
_count = byteCount
3737
}
3838
}
3939

@@ -49,7 +49,7 @@ extension MutableRawSpan {
4949
_unsafeBytes bytes: UnsafeMutableRawBufferPointer
5050
) {
5151
let baseAddress = bytes.baseAddress
52-
let span = MutableRawSpan(_unchecked: baseAddress, count: bytes.count)
52+
let span = MutableRawSpan(_unchecked: baseAddress, byteCount: bytes.count)
5353
self = _overrideLifetime(span, borrowing: bytes)
5454
}
5555

@@ -69,8 +69,8 @@ extension MutableRawSpan {
6969
_unsafeStart pointer: UnsafeMutableRawPointer,
7070
byteCount: Int
7171
) {
72-
precondition(byteCount >= 0, "Count must not be negative")
73-
self.init(_unchecked: pointer, count: byteCount)
72+
_precondition(byteCount >= 0, "Count must not be negative")
73+
self.init(_unchecked: pointer, byteCount: byteCount)
7474
}
7575

7676
@_alwaysEmitIntoClient
@@ -117,7 +117,7 @@ extension MutableRawSpan {
117117

118118
@_alwaysEmitIntoClient
119119
public var byteOffsets: Range<Int> {
120-
.init(uncheckedBounds: (0, byteCount))
120+
.init(_uncheckedBounds: (0, byteCount))
121121
}
122122
}
123123

@@ -216,7 +216,7 @@ extension MutableRawSpan {
216216
public func unsafeLoad<T>(
217217
fromByteOffset offset: Int = 0, as: T.Type
218218
) -> T {
219-
precondition(
219+
_precondition(
220220
UInt(bitPattern: offset) <= UInt(bitPattern: _count) &&
221221
MemoryLayout<T>.size <= (_count &- offset),
222222
"Byte offset range out of bounds"
@@ -271,7 +271,7 @@ extension MutableRawSpan {
271271
public func unsafeLoadUnaligned<T: BitwiseCopyable>(
272272
fromByteOffset offset: Int = 0, as: T.Type
273273
) -> T {
274-
precondition(
274+
_precondition(
275275
UInt(bitPattern: offset) <= UInt(bitPattern: _count) &&
276276
MemoryLayout<T>.size <= (_count &- offset),
277277
"Byte offset range out of bounds"
@@ -308,7 +308,7 @@ extension MutableRawSpan {
308308
public func storeBytes<T: BitwiseCopyable>(
309309
of value: T, toByteOffset offset: Int = 0, as type: T.Type
310310
) {
311-
precondition(
311+
_precondition(
312312
UInt(bitPattern: offset) <= UInt(bitPattern: _count) &&
313313
MemoryLayout<T>.size <= (_count &- offset),
314314
"Byte offset range out of bounds"
@@ -367,7 +367,7 @@ extension MutableRawSpan {
367367

368368
var elements = source.makeIterator()
369369
let lastOffset = update(startingAt: byteOffset, from: &elements)
370-
precondition(
370+
_precondition(
371371
elements.next() == nil,
372372
"destination span cannot contain every element from source."
373373
)

stdlib/public/core/Span/MutableSpan.swift

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ extension MutableSpan where Element: ~Copyable {
5858
public init(
5959
_unsafeElements buffer: UnsafeMutableBufferPointer<Element>
6060
) {
61-
precondition(
61+
_precondition(
6262
((Int(bitPattern: buffer.baseAddress) &
6363
(MemoryLayout<Element>.alignment&-1)) == 0),
6464
"baseAddress must be properly aligned to access Element"
@@ -73,7 +73,7 @@ extension MutableSpan where Element: ~Copyable {
7373
_unsafeStart start: UnsafeMutablePointer<Element>,
7474
count: Int
7575
) {
76-
precondition(count >= 0, "Count must not be negative")
76+
_precondition(count >= 0, "Count must not be negative")
7777
let buffer = UnsafeMutableBufferPointer(start: start, count: count)
7878
let ms = MutableSpan(_unsafeElements: buffer)
7979
self = _overrideLifetime(ms, borrowing: start)
@@ -102,14 +102,14 @@ extension MutableSpan where Element: BitwiseCopyable {
102102
public init(
103103
_unsafeBytes buffer: UnsafeMutableRawBufferPointer
104104
) {
105-
precondition(
105+
_precondition(
106106
((Int(bitPattern: buffer.baseAddress) &
107107
(MemoryLayout<Element>.alignment&-1)) == 0),
108108
"baseAddress must be properly aligned to access Element"
109109
)
110110
let (byteCount, stride) = (buffer.count, MemoryLayout<Element>.stride)
111111
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")
113113
let elements = UnsafeMutableBufferPointer<Element>(
114114
start: buffer.baseAddress?.assumingMemoryBound(to: Element.self),
115115
count: count
@@ -124,7 +124,7 @@ extension MutableSpan where Element: BitwiseCopyable {
124124
_unsafeStart pointer: UnsafeMutableRawPointer,
125125
byteCount: Int
126126
) {
127-
precondition(byteCount >= 0, "Count must not be negative")
127+
_precondition(byteCount >= 0, "Count must not be negative")
128128
let bytes = UnsafeMutableRawBufferPointer(start: pointer, count: byteCount)
129129
let ms = MutableSpan(_unsafeBytes: bytes)
130130
self = _overrideLifetime(ms, borrowing: pointer)
@@ -229,7 +229,7 @@ extension MutableSpan where Element: ~Copyable & ~Escapable {
229229

230230
@_alwaysEmitIntoClient
231231
public var indices: Range<Index> {
232-
Range(uncheckedBounds: (0, _count))
232+
Range(_uncheckedBounds: (0, _count))
233233
}
234234
}
235235

@@ -260,11 +260,11 @@ extension MutableSpan where Element: ~Copyable {
260260
@_alwaysEmitIntoClient
261261
public subscript(_ position: Index) -> Element {
262262
unsafeAddress {
263-
precondition(indices.contains(position), "index out of bounds")
263+
_precondition(indices.contains(position), "index out of bounds")
264264
return UnsafePointer(_unsafeAddressOfElement(unchecked: position))
265265
}
266266
unsafeMutableAddress {
267-
precondition(indices.contains(position), "index out of bounds")
267+
_precondition(indices.contains(position), "index out of bounds")
268268
return _unsafeAddressOfElement(unchecked: position)
269269
}
270270
}
@@ -303,8 +303,8 @@ extension MutableSpan where Element: ~Copyable {
303303

304304
@_alwaysEmitIntoClient
305305
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)))
308308
swapAt(unchecked: i, unchecked: j)
309309
}
310310

@@ -330,11 +330,11 @@ extension MutableSpan where Element: BitwiseCopyable {
330330
@_alwaysEmitIntoClient
331331
public subscript(_ position: Index) -> Element {
332332
get {
333-
precondition(indices.contains(position), "index out of bounds")
333+
_precondition(indices.contains(position), "index out of bounds")
334334
return self[unchecked: position]
335335
}
336336
set {
337-
precondition(indices.contains(position), "index out of bounds")
337+
_precondition(indices.contains(position), "index out of bounds")
338338
self[unchecked: position] = newValue
339339
}
340340
}
@@ -460,7 +460,7 @@ extension MutableSpan {
460460

461461
var iterator = source.makeIterator()
462462
let index = update(from: &iterator)
463-
precondition(
463+
_precondition(
464464
iterator.next() == nil,
465465
"destination buffer view cannot contain every element from source."
466466
)
@@ -470,7 +470,7 @@ extension MutableSpan {
470470
@_alwaysEmitIntoClient
471471
public mutating func update(fromContentsOf source: Span<Element>) -> Index {
472472
guard !source.isEmpty else { return 0 }
473-
precondition(
473+
_precondition(
474474
source.count <= self.count,
475475
"destination span cannot contain every element from source."
476476
)
@@ -498,7 +498,7 @@ extension MutableSpan where Element: ~Copyable {
498498
// fromContentsOf source: consuming OutputSpan<Element>
499499
// ) -> Index {
500500
// guard !source.isEmpty else { return 0 }
501-
// precondition(
501+
// _precondition(
502502
// source.count <= self.count,
503503
// "destination span cannot contain every element from source."
504504
// )
@@ -586,7 +586,7 @@ extension MutableSpan where Element: BitwiseCopyable {
586586

587587
var iterator = source.makeIterator()
588588
let index = update(from: &iterator)
589-
precondition(
589+
_precondition(
590590
iterator.next() == nil,
591591
"destination buffer view cannot contain every element from source."
592592
)
@@ -598,7 +598,7 @@ extension MutableSpan where Element: BitwiseCopyable {
598598
fromContentsOf source: Span<Element>
599599
) -> Index where Element: BitwiseCopyable {
600600
guard !source.isEmpty else { return 0 }
601-
precondition(
601+
_precondition(
602602
source.count <= self.count,
603603
"destination span cannot contain every element from source."
604604
)

0 commit comments

Comments
 (0)