Barrelfish
|
General Numa functions. More...
Macros | |
#define | BITMAP_BITS_PER_ELEMENT (8 * sizeof(bitmap_data_t)) |
helper macro for determining the number of | |
Typedefs | |
typedef uint32_t | bitmap_data_t |
< the bitmap data type to store the bitmap elements More... | |
Functions | |
struct bitmap * | bitmap_alloc (uint32_t nbits) |
allocates a new bitmap of a given size More... | |
void | bitmap_free (struct bitmap *bm) |
frees the resources of a bitmap More... | |
size_t | bitmap_format (char *outbuf, size_t length, struct bitmap *bm, uint8_t hex) |
formats the contents of the bitmap into the outbut buffer More... | |
size_t | bitmap_parse (struct bitmap *outbm, char *inbuf, size_t length, uint8_t hex) |
parses an input string and stores it into the bitmap More... | |
errval_t | bitmap_serialize (void *dest, size_t length, const struct bitmap *bm) |
serializes the bitmap into a buffer More... | |
errval_t | bitmap_deserialize (struct bitmap *bm, const void *src, size_t length) |
deserializes a bitmap form a buffer More... | |
uint32_t | bitmap_get_nbytes (const struct bitmap *bm) |
returns the number of bytes in the bitmap data representation More... | |
uint32_t | bitmap_get_nbits (const struct bitmap *bm) |
gets the number of bits of this bitmap More... | |
uint32_t | bitmap_get_weight (const struct bitmap *bm) |
gets the weight of the bit map i.e. number of set bits More... | |
void * | bitmap_raw (struct bitmap *bm) |
returns a pointer to the raw bitmap More... | |
bool | bitmap_is_bit_set (const struct bitmap *bm, bitmap_bit_t i) |
ckecks if a given bit is set More... | |
bool | bitmap_is_bit_clear (const struct bitmap *bm, bitmap_bit_t i) |
ckecks if a given bit is cleare More... | |
bool | bitmap_is_all_set (const struct bitmap *bm) |
checks if all bits are set More... | |
bool | bitmap_is_all_clear (const struct bitmap *bm) |
checks if all bits are clear More... | |
bitmap_bit_t | bitmap_get_first (const struct bitmap *bm) |
returns the bit number of the first set More... | |
bitmap_bit_t | bitmap_get_last (const struct bitmap *bm) |
returns the bit number of the last set More... | |
bitmap_bit_t | bitmap_get_next (const struct bitmap *bm, bitmap_bit_t i) |
gets the index of the next bit set More... | |
bitmap_bit_t | bitmap_get_prev (const struct bitmap *bm, bitmap_bit_t i) |
gets the index of the previous bit set More... | |
void | bitmap_set_bit (struct bitmap *bm, bitmap_bit_t i) |
sets a bit in the bitmap More... | |
void | bitmap_clear_bit (struct bitmap *bm, bitmap_bit_t i) |
clears a bit in the bitmap More... | |
void | bitmap_set_all (struct bitmap *bm) |
sets all the bits in the bitmap More... | |
void | bitmap_clear_all (struct bitmap *bm) |
clears all the bits in the bitmap More... | |
void | bitmap_set_range (struct bitmap *bm, bitmap_bit_t from, bitmap_bit_t to) |
sets a range of bits in the bitmap More... | |
void | bitmap_clear_range (struct bitmap *bm, bitmap_bit_t from, bitmap_bit_t to) |
sets a range of bits in the bitmap More... | |
void | bitmap_keep_range (struct bitmap *bm, uint32_t from, uint32_t to) |
clears the bitmap except for the given range More... | |
void | bitmap_copy (struct bitmap *to, const struct bitmap *from) |
copies one bitmap onto another More... | |
bool | bitmap_equal (const struct bitmap *bm1, const struct bitmap *bm2) |
determines if two bitmaps are equal More... | |
bool | bitmap_subset (const struct bitmap *haystack, const struct bitmap *needle) |
determines if one bitmask is a subset of the other More... | |
bool | bitmap_disjoint (const struct bitmap *bm1, const struct bitmap *bm2) |
determines if two bitmaps are disjoint i.e. not sharing a set bit More... | |
bool | bitmap_intersects (const struct bitmap *bm1, const struct bitmap *bm2) |
determines if two bitmaps are intersecting i.e. sharing a set bit More... | |
void | bitmap_complement (struct bitmap *bm) |
computes the complement to the bitmap More... | |
void | bitmap_shift_right (struct bitmap *bm, bitmap_bit_t n) |
performs a right shift operation on the bitmap More... | |
void | bitmap_shift_left (struct bitmap *bm, bitmap_bit_t n) |
performs a left shift operation on the bitmap More... | |
void | bitmap_and (struct bitmap *dst, const struct bitmap *src) |
performs a logical AND operation between two bitmaps More... | |
void | bitmap_nand (struct bitmap *dst, const struct bitmap *src) |
performs a logical NAND operation between two bitmaps More... | |
void | bitmap_or (struct bitmap *dst, const struct bitmap *src) |
performs a logical OR operation between two bitmaps More... | |
void | bitmap_xor (struct bitmap *dst, const struct bitmap *src) |
performs a logical AND operation between two bitmaps More... | |
General Numa functions.
typedef uint32_t bitmap_data_t |
< the bitmap data type to store the bitmap elements
helper macro for
struct bitmap* bitmap_alloc | ( | uint32_t | nbits | ) |
allocates a new bitmap of a given size
nbits | size of the bitmap |
void bitmap_and | ( | struct bitmap * | dst, |
const struct bitmap * | src | ||
) |
performs a logical AND operation between two bitmaps
dst | destination to store the new bitmap |
src | source bitmap |
dst = dst AND src
void bitmap_clear_all | ( | struct bitmap * | bm | ) |
clears all the bits in the bitmap
bm | bitmap to clear all bits |
void bitmap_clear_bit | ( | struct bitmap * | bm, |
bitmap_bit_t | i | ||
) |
clears a bit in the bitmap
bm | bitmap to set the bit |
i | index of the bit to clear |
void bitmap_clear_range | ( | struct bitmap * | bm, |
bitmap_bit_t | from, | ||
bitmap_bit_t | to | ||
) |
sets a range of bits in the bitmap
bm | bitmap to set the range |
from | start of the range (including) |
to | end of the range (including) |
void bitmap_complement | ( | struct bitmap * | bm | ) |
computes the complement to the bitmap
bm | the bitmap |
void bitmap_copy | ( | struct bitmap * | to, |
const struct bitmap * | from | ||
) |
copies one bitmap onto another
to | bitmap to copy into |
from | bitmap to copy from |
only the minimum number of bits in both bitmaps are copied. If the source is smaller than the destination remaining bits are cleared
errval_t bitmap_deserialize | ( | struct bitmap * | bm, |
const void * | src, | ||
size_t | length | ||
) |
deserializes a bitmap form a buffer
bm | bitmap to store the serialized data |
src | source buffer to read the serialized data from |
length | length of the source buffer |
bool bitmap_disjoint | ( | const struct bitmap * | bm1, |
const struct bitmap * | bm2 | ||
) |
determines if two bitmaps are disjoint i.e. not sharing a set bit
bm1 | the first bitmap |
bm2 | the second bitmap |
bool bitmap_equal | ( | const struct bitmap * | bm1, |
const struct bitmap * | bm2 | ||
) |
determines if two bitmaps are equal
bm1 | the first bitmap |
bm2 | the second bitmap |
size_t bitmap_format | ( | char * | outbuf, |
size_t | length, | ||
struct bitmap * | bm, | ||
uint8_t | hex | ||
) |
formats the contents of the bitmap into the outbut buffer
outbuf | buffer to hold the output data |
length | length of the output buffer |
bm | bitmap to format |
hex | flag to enable hexadecimal formatted output |
void bitmap_free | ( | struct bitmap * | bm | ) |
frees the resources of a bitmap
bm | bitmap to be freed |
bitmap_bit_t bitmap_get_first | ( | const struct bitmap * | bm | ) |
returns the bit number of the first set
bm | bitmap to get the first set bit |
bitmap_bit_t bitmap_get_last | ( | const struct bitmap * | bm | ) |
returns the bit number of the last set
bm | bitmap to get the last set bit |
uint32_t bitmap_get_nbits | ( | const struct bitmap * | bm | ) |
gets the number of bits of this bitmap
bm | the bitmap |
uint32_t bitmap_get_nbytes | ( | const struct bitmap * | bm | ) |
returns the number of bytes in the bitmap data representation
bm | bitmap to determine the bytes for |
bitmap_bit_t bitmap_get_next | ( | const struct bitmap * | bm, |
bitmap_bit_t | i | ||
) |
gets the index of the next bit set
bm | the bitmap to check |
i | bit to start checking from (not inclusive) |
bitmap_bit_t bitmap_get_prev | ( | const struct bitmap * | bm, |
bitmap_bit_t | i | ||
) |
gets the index of the previous bit set
bm | the bitmap to check |
i | index of the bit to check |
uint32_t bitmap_get_weight | ( | const struct bitmap * | bm | ) |
gets the weight of the bit map i.e. number of set bits
bm | the bitmap |
bool bitmap_intersects | ( | const struct bitmap * | bm1, |
const struct bitmap * | bm2 | ||
) |
determines if two bitmaps are intersecting i.e. sharing a set bit
bm1 | the first bitmap |
bm2 | the second bitmap |
bool bitmap_is_all_clear | ( | const struct bitmap * | bm | ) |
checks if all bits are clear
bm | bitmap to check |
bool bitmap_is_all_set | ( | const struct bitmap * | bm | ) |
checks if all bits are set
bm | bitmap to check |
bool bitmap_is_bit_clear | ( | const struct bitmap * | bm, |
bitmap_bit_t | i | ||
) |
ckecks if a given bit is cleare
bm | bitmap to check |
i | index of the bit |
bool bitmap_is_bit_set | ( | const struct bitmap * | bm, |
bitmap_bit_t | i | ||
) |
ckecks if a given bit is set
bm | bitmap to check |
i | index of the bit |
void bitmap_keep_range | ( | struct bitmap * | bm, |
uint32_t | from, | ||
uint32_t | to | ||
) |
clears the bitmap except for the given range
bm | bitmap to set the range |
from | start of the range (including) |
to | end of the range (including) |
void bitmap_nand | ( | struct bitmap * | dst, |
const struct bitmap * | src | ||
) |
performs a logical NAND operation between two bitmaps
dst | destination to store the new bitmap |
src | source bitmap |
dst = dst NAND src
void bitmap_or | ( | struct bitmap * | dst, |
const struct bitmap * | src | ||
) |
performs a logical OR operation between two bitmaps
dst | destination to store the new bitmap |
src | source bitmap |
dst = dst OR src
size_t bitmap_parse | ( | struct bitmap * | outbm, |
char * | inbuf, | ||
size_t | length, | ||
uint8_t | hex | ||
) |
parses an input string and stores it into the bitmap
outbm | bitmap to store the parsed data into |
inbuf | input string buffer |
length | length of the input string buffer |
hex | parse input as hex |
void* bitmap_raw | ( | struct bitmap * | bm | ) |
returns a pointer to the raw bitmap
bm | the bitmap |
errval_t bitmap_serialize | ( | void * | dest, |
size_t | length, | ||
const struct bitmap * | bm | ||
) |
serializes the bitmap into a buffer
dest | buffer to store the serialized bitmap |
length | lenght ouf the buffer |
bm | bitmap to serialize |
void bitmap_set_all | ( | struct bitmap * | bm | ) |
sets all the bits in the bitmap
bm | bitmap to set all bits |
void bitmap_set_bit | ( | struct bitmap * | bm, |
bitmap_bit_t | i | ||
) |
sets a bit in the bitmap
bm | bitmap to set the bit |
i | index of the bit to set |
void bitmap_set_range | ( | struct bitmap * | bm, |
bitmap_bit_t | from, | ||
bitmap_bit_t | to | ||
) |
sets a range of bits in the bitmap
bm | bitmap to set the range |
from | start of the range (including) |
to | end of the range (including) |
void bitmap_shift_left | ( | struct bitmap * | bm, |
bitmap_bit_t | n | ||
) |
performs a left shift operation on the bitmap
bm | the bitmap |
n | number of bits to shift |
void bitmap_shift_right | ( | struct bitmap * | bm, |
bitmap_bit_t | n | ||
) |
performs a right shift operation on the bitmap
bm | the bitmap |
n | number of bits to shift |
bool bitmap_subset | ( | const struct bitmap * | haystack, |
const struct bitmap * | needle | ||
) |
determines if one bitmask is a subset of the other
haystack | the original bitmap |
needle | the potential subset bitmap |
void bitmap_xor | ( | struct bitmap * | dst, |
const struct bitmap * | src | ||
) |
performs a logical AND operation between two bitmaps
dst | destination to store the new bitmap |
src | source bitmap |
dst = dst XOR src