mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add IndexSet::isDisjointWith
This commit is contained in:
@@ -197,6 +197,7 @@ public:
|
||||
|
||||
bool isSubsetOf(IndexSubset *other) const;
|
||||
bool isSupersetOf(IndexSubset *other) const;
|
||||
bool isDisjointWith(IndexSubset *other) const;
|
||||
|
||||
IndexSubset *adding(unsigned index, ASTContext &ctx) const;
|
||||
IndexSubset *extendingCapacity(ASTContext &ctx,
|
||||
|
||||
@@ -52,6 +52,14 @@ bool IndexSubset::isSupersetOf(IndexSubset *other) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IndexSubset::isDisjointWith(IndexSubset *other) const {
|
||||
assert(capacity == other->capacity);
|
||||
for (auto index : range(numBitWords))
|
||||
if (getBitWord(index) & other->getBitWord(index))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
IndexSubset *IndexSubset::adding(unsigned index, ASTContext &ctx) const {
|
||||
assert(index < getCapacity());
|
||||
if (contains(index))
|
||||
|
||||
Reference in New Issue
Block a user