BitVecDisjoint
Description
Check if two bitvectors are disjoint (have no common 1-bits).
Parameters
| Name | Direction | Description |
|---|---|---|
bv1 |
in | First bitvector |
bv2 |
in | Second bitvector |
Usage example (from documentation)
bool disjoint = BitVecDisjoint(&set1, &set2);Success
true if bitvectors have no common 1-bits
Failure
false when any position holds a 1 in both bitvectors.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
BitVec.c:850:
}
bool BitVecDisjoint(const BitVec *bv1, const BitVec *bv2) {
ValidateBitVec(bv1);
ValidateBitVec(bv2);- In
BitVec.c:866:
bool BitVecOverlaps(const BitVec *bv1, const BitVec *bv2) {
return !BitVecDisjoint(bv1, bv2);
}- In
Compare.c:443:
DefaultAllocator alloc = DefaultAllocatorInit();
WriteFmt("Testing BitVecDisjoint and BitVecIntersects\n");
BitVec bv1 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Compare.c:462:
// Should be disjoint and not intersect
bool result = BitVecDisjoint(&bv1, &bv2);
result = result && !BitVecOverlaps(&bv1, &bv2);- In
Compare.c:469:
// Should not be disjoint and should intersect
result = result && !BitVecDisjoint(&bv1, &bv2);
result = result && BitVecOverlaps(&bv1, &bv2);- In
Compare.c:475:
BitVecClear(&bv1);
BitVecClear(&bv2);
result = result && BitVecDisjoint(&bv1, &bv2);
result = result && !BitVecOverlaps(&bv1, &bv2);- In
Compare.c:727:
// Test with empty sets
result = result && !BitVecOverlaps(&bv1, &bv2);
result = result && BitVecDisjoint(&bv1, &bv2);
// Test single bit sets
- In
Compare.c:855:
// Test set operations on large vectors
bool overlaps = BitVecOverlaps(&large1, &large2);
bool disjoint = BitVecDisjoint(&large1, &large2);
result = result && (overlaps != disjoint); // Should be opposite
- In
Compare.c:1658:
Allocator *base = ALLOCATOR_OF(&alloc);
WriteFmt("Testing BitVecDisjoint scans beyond position 0\n");
BitVec bv1 = BitVecInit(base);- In
Compare.c:1673:
// They share 1-bits, so they are NOT disjoint.
bool result = (BitVecDisjoint(&bv1, &bv2) == false);
BitVecDeinit(&bv1);- In
Compare.c:1706:
Allocator *base = ALLOCATOR_OF(&alloc);
WriteFmt("Testing BitVecDisjoint rejects NULL bv1\n");
BitVec bv2 = BitVecInit(base);- In
Compare.c:1712:
// Should abort on the NULL first argument.
BitVecDisjoint(NULL, &bv2);
BitVecDeinit(&bv2);- In
Compare.c:1725:
Allocator *base = ALLOCATOR_OF(&alloc);
WriteFmt("Testing BitVecDisjoint rejects NULL bv2\n");
BitVec bv1 = BitVecInit(base);- In
Compare.c:1731:
// Should abort on the NULL second argument.
BitVecDisjoint(&bv1, NULL);
BitVecDeinit(&bv1);
Last updated on