diff --git a/utils/src/bitmap.c b/utils/src/bitmap.c index 5e9ab615..c295b21a 100644 --- a/utils/src/bitmap.c +++ b/utils/src/bitmap.c @@ -10,6 +10,11 @@ * Just a quick simple native bitmap. */ +int test_bit(unsigned long *bits, u64 nr) +{ + return !!(bits[nr / BITS_PER_LONG] & (1UL << (nr & (BITS_PER_LONG - 1)))); +} + void set_bit(unsigned long *bits, u64 nr) { bits[nr / BITS_PER_LONG] |= 1UL << (nr & (BITS_PER_LONG - 1)); diff --git a/utils/src/bitmap.h b/utils/src/bitmap.h index 993bad4e..7b3ef927 100644 --- a/utils/src/bitmap.h +++ b/utils/src/bitmap.h @@ -1,6 +1,7 @@ #ifndef _BITMAP_H_ #define _BITMAP_H_ +int test_bit(unsigned long *bits, u64 nr); void set_bit(unsigned long *bits, u64 nr); void clear_bit(unsigned long *bits, u64 nr); u64 find_next_set_bit(unsigned long *start, u64 from, u64 total);