Reduct  v4.0.5-1-g4851deb
A functional and immutable language.
Loading...
Searching...
No Matches
bitmap.h File Reference

Bitmap utilities. More...

#include <reduct/defs.h>
Include dependency graph for bitmap.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define REDUCT_BITMAP_WIDTH   64
 The number of bits in a bitmap word.
 
#define REDUCT_BITMAP_INDEX_NONE   (~(uint64_t)0)
 Invalid bitmap index.
 
#define REDUCT_BITMAP_SIZE(_size)   (((_size) + (REDUCT_BITMAP_WIDTH - 1)) / REDUCT_BITMAP_WIDTH)
 Calculate the number of 64-bit words needed for a bitmap of a given size.
 
#define REDUCT_BITMAP_SET(_bitmap, _bit)    ((_bitmap)[(_bit) / REDUCT_BITMAP_WIDTH] |= (1ULL << ((_bit) % REDUCT_BITMAP_WIDTH)))
 Set a bit in a bitmap.
 
#define REDUCT_BITMAP_CLEAR(_bitmap, _bit)    ((_bitmap)[(_bit) / REDUCT_BITMAP_WIDTH] &= ~(1ULL << ((_bit) % REDUCT_BITMAP_WIDTH)))
 Clear a bit in a bitmap.
 
#define REDUCT_BITMAP_TEST(_bitmap, _bit)    (((_bitmap)[(_bit) / REDUCT_BITMAP_WIDTH] & (1ULL << ((_bit) % REDUCT_BITMAP_WIDTH))) != 0)
 Check if a bit is set in a bitmap.
 

Typedefs

typedef uint64_t reduct_bitmap_t
 A single word in a bitmap.
 

Functions

static size_t reduct_bitmap_set_range (reduct_bitmap_t *bitmap, size_t start, size_t count)
 Set a range of bits in a bitmap.
 
static size_t reduct_bitmap_find_first_clear (const reduct_bitmap_t *bitmap, size_t size)
 Find the first clear bit in a bitmap.
 
static size_t reduct_bitmap_next_set (const reduct_bitmap_t *bitmap, size_t size, size_t start)
 Find the next set bit in a bitmap starting from a given index.
 
static size_t reduct_bitmap_next_clear (const reduct_bitmap_t *bitmap, size_t size, size_t start)
 Find the next clear bit in a bitmap starting from a given index.
 
static size_t reduct_bitmap_find_last_set (const reduct_bitmap_t *bitmap, size_t size)
 Find the last set bit in a bitmap.
 

Detailed Description

Bitmap utilities.

Definition in file bitmap.h.