Browse Source

AP_Common: add support for comparing BitMasks

apm_2208
bugobliterator 3 years ago committed by Andrew Tridgell
parent
commit
3c87062f27
  1. 12
      libraries/AP_Common/Bitmask.h

12
libraries/AP_Common/Bitmask.h

@ -37,6 +37,18 @@ public: @@ -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

Loading…
Cancel
Save