mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-25 01:05:21 +03:00
Fix incorrect return value in bitArrayFindFirstSet() when using non-zero start
When the first bit set is in the same 4-byte group that the start (with start > 31), the returned index is off by the last multiple of 32 <= start. This could cause unnecessary updates in the OSD driver, since a non-dirty char would be actually updated while it hadn't changed.
This commit is contained in:
parent
38c0caa12b
commit
9af8bd1236
2 changed files with 3 additions and 1 deletions
|
@ -59,6 +59,8 @@ TEST(BitArrayTest, TestFind)
|
|||
EXPECT_EQ(bitArrayFindFirstSet(p, 16, sizeof(p)), 44);
|
||||
EXPECT_EQ(bitArrayFindFirstSet(p, 17, sizeof(p)), 44);
|
||||
EXPECT_EQ(bitArrayFindFirstSet(p, 18, sizeof(p)), 44);
|
||||
EXPECT_EQ(bitArrayFindFirstSet(p, 43, sizeof(p)), 44);
|
||||
EXPECT_EQ(bitArrayFindFirstSet(p, 44, sizeof(p)), 44);
|
||||
EXPECT_EQ(bitArrayFindFirstSet(p, 45, sizeof(p)), -1);
|
||||
|
||||
bitArrayClr(p, 44);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue