changed uncheckedBounds to just unchecked

This commit is contained in:
Guillaume Lessard committed 2024-07-02 14:02:58 -07:00
1 parent cb6b7c9a55
commit fefc900b92
3 files changed
+9 -9

No files matched your search

+4 -4
View File
@@ -184,7 +184,7 @@ extension RawSpan {
@inlinable @inline(__always)
public func extracting(_ bounds: Range<Int>) -> Self {
assertValidity(bounds)
return extracting(uncheckedBounds: bounds)
return extracting(unchecked: bounds)
}
/// Constructs a new span over the bytes within the supplied range of
@@ -203,7 +203,7 @@ extension RawSpan {
///
/// - Complexity: O(1)
@inlinable @inline(__always)
public func extracting(uncheckedBounds bounds: Range<Int>) -> Self {
public func extracting(unchecked bounds: Range<Int>) -> Self {
RawSpan(
_unchecked: _start.advanced(by: bounds.lowerBound),
byteCount: bounds.count,
@@ -246,9 +246,9 @@ extension RawSpan {
/// - Complexity: O(1)
@_alwaysEmitIntoClient
public func extracting(
uncheckedBounds bounds: some RangeExpression<Int>
unchecked bounds: some RangeExpression<Int>
) -> Self {
extracting(uncheckedBounds: bounds.relative(to: _byteOffsets))
extracting(unchecked: bounds.relative(to: _byteOffsets))
}
/// Constructs a new span over all the bytes of this span.
+3 -3
View File
@@ -423,7 +423,7 @@ extension Span where Element: ~Copyable /*& ~Escapable*/ {
@inlinable @inline(__always)
public func extracting(_ bounds: Range<Int>) -> Self {
assertValidity(bounds)
return extracting(uncheckedBounds: bounds)
return extracting(unchecked: bounds)
}
/// Constructs a new span over the items within the supplied range of
@@ -442,7 +442,7 @@ extension Span where Element: ~Copyable /*& ~Escapable*/ {
///
/// - Complexity: O(1)
@inlinable @inline(__always)
public func extracting(uncheckedBounds bounds: Range<Int>) -> Self {
public func extracting(unchecked bounds: Range<Int>) -> Self {
Span(
_unchecked: _start.advanced(by: bounds.lowerBound),
count: bounds.count,
@@ -487,7 +487,7 @@ extension Span where Element: ~Copyable /*& ~Escapable*/ {
public func extracting(
uncheckedBounds bounds: some RangeExpression<Int>
) -> Self {
extracting(uncheckedBounds: bounds.relative(to: _indices))
extracting(unchecked: bounds.relative(to: _indices))
}
/// Constructs a new span over all the items of this span.
+2 -2
View File
@@ -104,7 +104,7 @@ final class RawSpanTests: XCTestCase {
let sub1 = span.extracting(0..<2)
let sub2 = span.extracting(..<2)
let sub3 = span.extracting(...)
let sub4 = span.extracting(uncheckedBounds: 2...)
let sub4 = span.extracting(unchecked: 2...)
XCTAssertTrue(
sub1.unsafeView(as: UInt8.self)._elementsEqual(sub2.unsafeView(as: UInt8.self))
)
@@ -123,7 +123,7 @@ final class RawSpanTests: XCTestCase {
b.withUnsafeBytes {
let span = RawSpan(unsafeBytes: $0, owner: $0)
let prefix = span.extracting(0..<8)
let beyond = prefix.extracting(uncheckedBounds: 16..<24)
let beyond = prefix.extracting(unchecked: 16..<24)
XCTAssertEqual(beyond.byteCount, 8)
XCTAssertEqual(beyond.unsafeLoad(as: UInt8.self), 16)
}