mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-03-13 10:03:57 -03:00
AP_Common: Add cont array constructor to AP_Bitmask
Signed-off-by: Ryan Friedman <25047695+Ryanf55@users.noreply.github.com>
This commit is contained in:
parent
f236a6c6fc
commit
a5ed6ee6d4
@ -53,6 +53,18 @@ public:
|
||||
|
||||
Bitmask(const Bitmask &other) = delete;
|
||||
|
||||
|
||||
// Construct a bitmask with some bits enabled.
|
||||
template<size_t N>
|
||||
Bitmask(const uint16_t (&enabled_bits)[N]) {
|
||||
clearall();
|
||||
for (size_t i = 0; i < N; ++i) {
|
||||
if (enabled_bits[i] < NUMBITS) {
|
||||
set(enabled_bits[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set given bitnumber
|
||||
void set(uint16_t bit) {
|
||||
if (!validate(bit)) {
|
||||
|
Loading…
Reference in New Issue
Block a user