mirror of
https://github.com/apple/swift-collections
synced 2026-11-30 05:18:44 +00:00
fix a bounds-checking detail
This commit is contained in:
1 parent
fbabfd5d66
commit
f18b91b719
2 files changed
+4
-4
No files matched your search
@@ -218,7 +218,7 @@ extension RawSpan {
|
||||
/// - Returns: true if `offsets` is a valid range of byte offsets
|
||||
@_alwaysEmitIntoClient
|
||||
public func boundsContain(_ offsets: Range<Int>) -> Bool {
|
||||
0 <= offsets.lowerBound && offsets.upperBound <= byteCount
|
||||
boundsContain(offsets.lowerBound) && offsets.upperBound <= byteCount
|
||||
}
|
||||
|
||||
/// Return true if `offsets` is a valid range of offsets into this `RawSpan`
|
||||
@@ -228,7 +228,7 @@ extension RawSpan {
|
||||
/// - Returns: true if `offsets` is a valid range of byte offsets
|
||||
@_alwaysEmitIntoClient
|
||||
public func boundsContain(_ offsets: ClosedRange<Int>) -> Bool {
|
||||
0 <= offsets.lowerBound && offsets.upperBound < byteCount
|
||||
boundsContain(offsets.lowerBound) && offsets.upperBound < byteCount
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -373,7 +373,7 @@ extension Span where Element: ~Copyable {
|
||||
/// - Returns: true if `offsets` is a valid range of indices
|
||||
@_alwaysEmitIntoClient
|
||||
public func boundsContain(_ offsets: Range<Int>) -> Bool {
|
||||
0 <= offsets.lowerBound && offsets.upperBound <= count
|
||||
boundsContain(offsets.lowerBound) && offsets.upperBound <= count
|
||||
}
|
||||
|
||||
/// Return true if `offsets` is a valid range of offsets into this `Span`
|
||||
@@ -383,7 +383,7 @@ extension Span where Element: ~Copyable {
|
||||
/// - Returns: true if `offsets` is a valid range of indices
|
||||
@_alwaysEmitIntoClient
|
||||
public func boundsContain(_ offsets: ClosedRange<Int>) -> Bool {
|
||||
0 <= offsets.lowerBound && offsets.upperBound < count
|
||||
boundsContain(offsets.lowerBound) && offsets.upperBound < count
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user