AP_Common: clean up bitmask operators

Code already won't compile if there are different numbers of bits as the
template parameter will be different.
This commit is contained in:
Thomas Watson 2024-07-07 15:08:16 -05:00 committed by Andrew Tridgell
parent b030b8e789
commit 6a4520e8fd
1 changed files with 2 additions and 6 deletions

View File

@ -39,16 +39,12 @@ public:
} }
Bitmask &operator=(const Bitmask&other) { Bitmask &operator=(const Bitmask&other) {
memcpy(bits, other.bits, sizeof(bits[0])*other.numwords); memcpy(bits, other.bits, sizeof(bits[0])*numwords);
return *this; return *this;
} }
bool operator==(const Bitmask&other) { bool operator==(const Bitmask&other) {
if (other.numbits != numbits) { return memcmp(bits, other.bits, sizeof(bits[0])*numwords) == 0;
return false;
} else {
return memcmp(bits, other.bits, sizeof(bits[0])*numwords) == 0;
}
} }
bool operator!=(const Bitmask&other) { bool operator!=(const Bitmask&other) {