Bit Operations Interface
DESCRIPTION
Bit operations interface. The interface can be used to set, clear and find bits in an arbitrarily large bitmap. The interface does not support setting the bits atomically.
EXAMPLE
Example with a pre-allocated bitmap: // Declare bitmap of size of 500 bits SILC_BITMAP_DECLARE(bitmap, 500); int bitmap_size = SILC_BITMAP_SIZE(500); // Set 0 bit silc_bit_set(bitmap, bitmap_size, 0); // Set bit number 100 silc_bit_set(bitmap, bitmap_size, 100); // Find first set bit from the bitmap bit = silc_bit_ffs(bitmap, bitmap_size); // Find next set bit from the bitmap bit = silc_bit_fns(bitmap, bitmap_size, bit + 1); // Clear bit number 100 silc_bit_set(bitmap, bitmap_size, 100);
TABLE OF CONTENTS