File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
stdlib/public/Synchronization/Atomics
test/stdlib/Synchronization/Atomics Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -191,7 +191,11 @@ extension WordPair: Comparable {
191
191
@_alwaysEmitIntoClient
192
192
@_transparent
193
193
public func < ( lhs: WordPair , rhs: WordPair ) -> Bool {
194
- lhs. first < rhs. first || lhs. second < rhs. second
194
+ if lhs. first != rhs. first {
195
+ return lhs. first < rhs. first
196
+ } else {
197
+ return lhs. second < rhs. second
198
+ }
195
199
}
196
200
}
197
201
Original file line number Diff line number Diff line change @@ -50,11 +50,15 @@ suite.test("basics") {
50
50
let c1 = WordPair ( first: 1 , second: 0 )
51
51
let c2 = WordPair ( first: 2 , second: 0 )
52
52
let c3 = WordPair ( first: 0 , second: 1 )
53
+ let c4 = WordPair ( first: 1 , second: 2 )
54
+ let c5 = WordPair ( first: 2 , second: 1 )
53
55
expectFalse ( c0 < c0)
54
56
expectTrue ( c0 < c1)
55
57
expectTrue ( c0 < c2)
56
58
expectTrue ( c0 < c3)
57
59
expectFalse ( c1 < c0)
60
+ expectTrue ( c4 < c5)
61
+ expectFalse ( c5 < c4)
58
62
}
59
63
60
64
} // if #available(SwiftStdlib 6.0, *)
You can’t perform that action at this time.
0 commit comments