From 9a89223531979fc2860a213b23364ccff83b9005 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Sun, 7 Jul 2024 14:50:07 -0500 Subject: [PATCH] AP_Common: fix bitmask setall() Fixes an issue where the last word was not set to all 1s if the number of bits evenly divided the word size. Also fixes UB if there were 31 valid bits. --- libraries/AP_Common/Bitmask.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libraries/AP_Common/Bitmask.h b/libraries/AP_Common/Bitmask.h index 233d1b3e26..02fe1c10fc 100644 --- a/libraries/AP_Common/Bitmask.h +++ b/libraries/AP_Common/Bitmask.h @@ -65,13 +65,15 @@ public: // set all bits void setall(void) { - // set all words to 111... except the last one. - for (uint16_t i=0; i