Skip to content

Commit

Permalink
libmetal: set ept address loop++ in bitmap
Browse files Browse the repository at this point in the history
Change-Id: I67ce05ddd7867931359ea12a3c420a6edff4de80
Signed-off-by: ligd <[email protected]>
  • Loading branch information
GUIDINGLI committed Oct 13, 2023
1 parent ddd72ec commit 70d46aa
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,19 @@ metal_bitmap_next_clear_bit(unsigned long *bitmap, unsigned int start,
return bit;
}

static inline unsigned int
metal_bitmap_loopnext_clear_bit(unsigned long *bitmap, unsigned int start,
unsigned int max)
{
unsigned int bit;

for (bit = start;
bit < max + start && !metal_bitmap_is_bit_clear(bitmap, bit % max);
bit++)
;
return bit % max;
}

#define metal_bitmap_for_each_clear_bit(bitmap, bit, max) \
for ((bit) = metal_bitmap_next_clear_bit((bitmap), 0, (max)); \
(bit) < (max); \
Expand Down

0 comments on commit 70d46aa

Please sign in to comment.