AP_Common: add support for comparing BitMasks

This commit is contained in:
bugobliterator 2022-04-29 17:20:19 +05:30 committed by Andrew Tridgell
parent 2375564bb2
commit 3c87062f27
1 changed files with 12 additions and 0 deletions

View File

@ -37,6 +37,18 @@ public:
return *this;
}
bool operator==(const Bitmask&other) {
if (other.numbits != numbits) {
return false;
} else {
return memcmp(bits, other.bits, sizeof(bits[0])*numwords) == 0;
}
}
bool operator!=(const Bitmask&other) {
return !(*this == other);
}
Bitmask(const Bitmask &other) = delete;
// set given bitnumber