1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-23 16:25:26 +03:00
Commit graph

7 commits

Author SHA1 Message Date
JuliooCesarMDM
59d81d6f6f Add ZeroFArray Macro and make use of it in some parts 2022-10-04 17:18:01 -03:00
Alberto García Hierro
7f1a7d5a0b
[BITARRAY] Bounds check in the first iteration in bitArrayFindFirstSet() (#5707)
We already had bounds checking for the 2nd and subsequent 32 bit
blocks, but since the first block was handled separately (due to the
masking needed if it doesn't fall on a 32 bit boundary) it skipped
the check. With this change, any start bit >= the number of bits
in the array will return -1.
2020-05-16 17:38:31 +02:00
Alberto García Hierro
fe4c215886 Add bitarray functions for setting and clearing all the array
- bitArraySetAll() and bitArrayClrAll() set and clear the whole
array, with the size (in bytes) specified by the caller (to make
them work like bitArrayFindFirstSet())
- macros BITARRAY_SET_ALL() and BITARRAY_CLR_ALL() call those two
new functions using sizeof(array) as its size
2018-12-26 11:53:20 +00:00
Alberto García Hierro
9af8bd1236 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.
2018-12-26 11:50:20 +00:00
Alberto García Hierro
ea685c5dd5 Fix bitarray tests
Rhe declaration has changed from void* to uint32_t*, which
is not a valid implicit conversion in C++.

Note to self: find out why there were not failing in travis builds,
2017-09-16 22:37:22 +01:00
Alberto García Hierro
daa4c17c3b Implement bitArrayFindFirstSet()
Returns the 1st bit set from a bitarray from a given starting
index. Can be used to quickly iterate over the set bits.
2017-09-15 09:58:53 +01:00
Alberto García Hierro
1dbe90ba1e Add some unit tests for bitarray
Just to make sure the upcoming changes don't break anything
2017-09-15 09:58:53 +01:00