File tree Expand file tree Collapse file tree 3 files changed +19
-16
lines changed Expand file tree Collapse file tree 3 files changed +19
-16
lines changed Original file line number Diff line number Diff line change @@ -128,7 +128,8 @@ extension ClosedRange: RangeExpression {
128
128
/// - Parameter element: The element to check for containment.
129
129
/// - Returns: `true` if `element` is contained in the range; otherwise,
130
130
/// `false`.
131
- @_transparent
131
+ @inlinable
132
+ @inline ( __always)
132
133
public func contains( _ element: Bound ) -> Bool {
133
134
return element >= self . lowerBound && element <= self . upperBound
134
135
}
@@ -383,7 +384,7 @@ extension ClosedRange {
383
384
///
384
385
/// - Complexity: O(1)
385
386
@_alwaysEmitIntoClient
386
- @_transparent
387
+ @inline ( __always )
387
388
public func contains( _ other: ClosedRange < Bound > ) -> Bool {
388
389
lowerBound <= other. lowerBound && upperBound >= other. upperBound
389
390
}
Original file line number Diff line number Diff line change @@ -195,7 +195,8 @@ public struct Range<Bound: Comparable> {
195
195
/// - Parameter element: The element to check for containment.
196
196
/// - Returns: `true` if `element` is contained in the range; otherwise,
197
197
/// `false`.
198
- @_transparent
198
+ @inlinable
199
+ @inline ( __always)
199
200
public func contains( _ element: Bound ) -> Bool {
200
201
return lowerBound <= element && element < upperBound
201
202
}
@@ -683,7 +684,8 @@ extension PartialRangeFrom: RangeExpression {
683
684
) -> Range < Bound > where C. Index == Bound {
684
685
return self . lowerBound..< collection. endIndex
685
686
}
686
- @_transparent
687
+ @inlinable
688
+ @inline ( __always)
687
689
public func contains( _ element: Bound ) -> Bool {
688
690
return lowerBound <= element
689
691
}
@@ -1075,12 +1077,12 @@ extension Range {
1075
1077
///
1076
1078
/// - Complexity: O(1)
1077
1079
@_alwaysEmitIntoClient
1078
- @_transparent
1080
+ @inline ( __always )
1079
1081
public func contains( _ other: Range < Bound > ) -> Bool {
1080
1082
other. isEmpty ||
1081
1083
( lowerBound <= other. lowerBound && upperBound >= other. upperBound)
1082
1084
}
1083
-
1085
+
1084
1086
/// Returns a Boolean value indicating whether the given closed range is
1085
1087
/// contained within this range.
1086
1088
///
@@ -1103,7 +1105,7 @@ extension Range {
1103
1105
///
1104
1106
/// - Complexity: O(1)
1105
1107
@_alwaysEmitIntoClient
1106
- @_transparent
1108
+ @inline ( __always )
1107
1109
public func contains( _ other: ClosedRange < Bound > ) -> Bool {
1108
1110
lowerBound <= other. lowerBound && upperBound > other. upperBound
1109
1111
}
Original file line number Diff line number Diff line change 10
10
// The sample functions below use bounds of different integer types to avoid
11
11
// them tail-calling each other.
12
12
13
- // CHECK-LABEL: define {{.*}} i1 @"$s21RangeContainsInlining08halfOpenB0ySbSnys4Int8VG_ADtF"
14
- // CHECK-NOT: call swiftcc
15
- // CHECK: icmp
16
- // CHECK-NOT: call swiftcc
17
- // CHECK-LABEL: {{^}}}
13
+ // CHECK-OPTIMIZED- LABEL: define {{.*}} i1 @"$s21RangeContainsInlining08halfOpenB0ySbSnys4Int8VG_ADtF"
14
+ // CHECK-OPTIMIZED- NOT: call swiftcc
15
+ // CHECK-OPTIMIZED : icmp
16
+ // CHECK-OPTIMIZED- NOT: call swiftcc
17
+ // CHECK-OPTIMIZED- LABEL: {{^}}}
18
18
public func halfOpenContains( _ r: Range < Int8 > , _ i: Int8 ) -> Bool {
19
19
r. contains ( i)
20
20
}
21
21
22
22
// CHECK-LABEL: define {{.*}} i1 @"$s21RangeContainsInlining06closedB0ySbSNys5Int16VG_ADtF"
23
- // CHECK-NOT: call swiftcc
24
- // CHECK: icmp
25
- // CHECK-NOT: call swiftcc
26
- // CHECK-LABEL: {{^}}}
23
+ // CHECK-OPTIMIZED- NOT: call swiftcc
24
+ // CHECK-OPTIMIZED : icmp
25
+ // CHECK-OPTIMIZED- NOT: call swiftcc
26
+ // CHECK-OPTIMIZED- LABEL: {{^}}}
27
27
public func closedContains( _ r: ClosedRange < Int16 > , _ i: Int16 ) -> Bool {
28
28
r. contains ( i)
29
29
}
You can’t perform that action at this time.
0 commit comments