Skip to content

Commit

Permalink
bitops.h: Improve find_xxx_bit() documentation
Browse files Browse the repository at this point in the history
Document the following functions return the bitmap size
if no matching bit is found:

- find_first_bit
- find_next_bit
- find_last_bit
- find_first_zero_bit
- find_next_zero_bit

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20210510200758.2623154-2-philmd@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
  • Loading branch information
philmd authored and stefanhaRH committed May 21, 2021
1 parent d902268 commit 5c6ae58
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions include/qemu/bitops.h
Expand Up @@ -140,7 +140,8 @@ static inline int test_bit(long nr, const unsigned long *addr)
* @addr: The address to start the search at
* @size: The maximum size to search
*
* Returns the bit number of the first set bit, or size.
* Returns the bit number of the last set bit,
* or @size if there is no set bit in the bitmap.
*/
unsigned long find_last_bit(const unsigned long *addr,
unsigned long size);
Expand All @@ -150,6 +151,9 @@ unsigned long find_last_bit(const unsigned long *addr,
* @addr: The address to base the search on
* @offset: The bitnumber to start searching at
* @size: The bitmap size in bits
*
* Returns the bit number of the next set bit,
* or @size if there are no further set bits in the bitmap.
*/
unsigned long find_next_bit(const unsigned long *addr,
unsigned long size,
Expand All @@ -160,6 +164,9 @@ unsigned long find_next_bit(const unsigned long *addr,
* @addr: The address to base the search on
* @offset: The bitnumber to start searching at
* @size: The bitmap size in bits
*
* Returns the bit number of the next cleared bit,
* or @size if there are no further clear bits in the bitmap.
*/

unsigned long find_next_zero_bit(const unsigned long *addr,
Expand All @@ -171,7 +178,8 @@ unsigned long find_next_zero_bit(const unsigned long *addr,
* @addr: The address to start the search at
* @size: The maximum size to search
*
* Returns the bit number of the first set bit.
* Returns the bit number of the first set bit,
* or @size if there is no set bit in the bitmap.
*/
static inline unsigned long find_first_bit(const unsigned long *addr,
unsigned long size)
Expand All @@ -194,7 +202,8 @@ static inline unsigned long find_first_bit(const unsigned long *addr,
* @addr: The address to start the search at
* @size: The maximum size to search
*
* Returns the bit number of the first cleared bit.
* Returns the bit number of the first cleared bit,
* or @size if there is no clear bit in the bitmap.
*/
static inline unsigned long find_first_zero_bit(const unsigned long *addr,
unsigned long size)
Expand Down

0 comments on commit 5c6ae58

Please sign in to comment.