Skip to content

Commit

Permalink
Short circuit == when ordered sets don't have same size. (#2556)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrandonw authored Nov 9, 2023
1 parent 17c0cba commit 178b021
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-concurrency-extras",
"state" : {
"revision" : "6155400cb15b0d99b2c257d57603d61d03a817a8",
"version" : "1.0.1"
"revision" : "bb5059bde9022d69ac516803f4f227d8ac967f71",
"version" : "1.1.0"
}
},
{
Expand Down Expand Up @@ -113,7 +113,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-snapshot-testing.git",
"state" : {
"revision" : "bbc9ec6e41ba964a5d04371af0acfb574cadafbd"
"revision" : "bb0ea08db8e73324fe6c3727f755ca41a23ff2f4",
"version" : "1.14.2"
}
},
{
Expand All @@ -137,7 +138,7 @@
{
"identity" : "swiftui-navigation",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swiftui-navigation",
"location" : "https://github.com/pointfreeco/swiftui-navigation.git",
"state" : {
"revision" : "74adfb8e48724c50d0ac148c658ae5fa7dfd6b6d",
"version" : "1.0.3"
Expand Down
4 changes: 2 additions & 2 deletions Examples/Integration/Integration.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -838,8 +838,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/pointfreeco/swift-snapshot-testing.git";
requirement = {
kind = revision;
revision = bbc9ec6e41ba964a5d04371af0acfb574cadafbd;
kind = upToNextMajorVersion;
minimumVersion = 1.0.0;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import OrderedCollections

@inlinable
func areOrderedSetsDuplicates<T>(_ lhs: OrderedSet<T>, _ rhs: OrderedSet<T>) -> Bool {
withUnsafePointer(to: lhs) { lhsPointer in
guard lhs.count == rhs.count
else { return false }

return withUnsafePointer(to: lhs) { lhsPointer in
withUnsafePointer(to: rhs) { rhsPointer in
memcmp(lhsPointer, rhsPointer, MemoryLayout<OrderedSet<T>>.size) == 0 || lhs == rhs
}
Expand Down

0 comments on commit 178b021

Please sign in to comment.