fix a bounds-checking detail

This commit is contained in:
Guillaume Lessard committed 2024-10-06 10:24:55 -07:00
1 parent fbabfd5d66
commit f18b91b719
2 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -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
}
}
+2 -2
View File
@@ -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
}
}