bitmap.h 639 Bytes
Newer Older
Andreas Schmidt's avatar
Andreas Schmidt committed
1 2 3 4 5 6 7 8 9 10 11 12 13
#ifndef PRRT_BITMAP_H
#define PRRT_BITMAP_H

#include <stdint.h>
#include <stdbool.h>

typedef struct bitmap {
    uint32_t* data;
    uint32_t count;
} Bitmap;

Bitmap *Bitmap_create(bool initialValue, uint32_t elementCount);
bool Bitmap_get(Bitmap* bitmap, uint32_t position);
14
bool Bitmap_set(Bitmap* bitmap, uint32_t position, bool value);
Andreas Schmidt's avatar
Andreas Schmidt committed
15 16 17 18 19 20
void Bitmap_set_range(Bitmap *bitmap, uint32_t start, uint32_t length, bool value);
uint32_t Bitmap_sum_ones(Bitmap *bitmap, uint32_t start, uint32_t length);
uint32_t Bitmap_sum_zeros(Bitmap *bitmap, uint32_t start, uint32_t length);
bool Bitmap_destroy(Bitmap* bitmap);

#endif //PRRT_BITMAP_H