summaryrefslogtreecommitdiff
path: root/src/basic/bitmap.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-07-23 11:35:55 +0200
committerTom Gundersen <teg@jklm.no>2015-07-23 11:35:55 +0200
commitf4955d321e6c08914cd2e1229df154aae8840d88 (patch)
tree1ad732e6e53435c040c0150d54b1b53c76b58288 /src/basic/bitmap.c
parent56511eca83b3e078ffce6514c12c7cb075d3eeb1 (diff)
parent848d08b74eb0272774b1f8eff688d00ed9b63d9d (diff)
Merge pull request #677 from zonque/bitmap2
basic: bitmap: use uint64_t instead if long long unsigned
Diffstat (limited to 'src/basic/bitmap.c')
-rw-r--r--src/basic/bitmap.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/basic/bitmap.c b/src/basic/bitmap.c
index 7e47c2d09f..8f423deee3 100644
--- a/src/basic/bitmap.c
+++ b/src/basic/bitmap.c
@@ -24,7 +24,7 @@
#include "bitmap.h"
struct Bitmap {
- long long unsigned *bitmaps;
+ uint64_t *bitmaps;
size_t n_bitmaps;
size_t bitmaps_allocated;
};
@@ -37,9 +37,9 @@ struct Bitmap {
/* This indicates that we reached the end of the bitmap */
#define BITMAP_END ((unsigned) -1)
-#define BITMAP_NUM_TO_OFFSET(n) ((n) / (sizeof(long long unsigned) * 8))
-#define BITMAP_NUM_TO_REM(n) ((n) % (sizeof(long long unsigned) * 8))
-#define BITMAP_OFFSET_TO_NUM(offset, rem) ((offset) * sizeof(long long unsigned) * 8 + (rem))
+#define BITMAP_NUM_TO_OFFSET(n) ((n) / (sizeof(uint64_t) * 8))
+#define BITMAP_NUM_TO_REM(n) ((n) % (sizeof(uint64_t) * 8))
+#define BITMAP_OFFSET_TO_NUM(offset, rem) ((offset) * sizeof(uint64_t) * 8 + (rem))
Bitmap *bitmap_new(void) {
return new0(Bitmap, 1);
@@ -69,7 +69,7 @@ int bitmap_ensure_allocated(Bitmap **b) {
}
int bitmap_set(Bitmap *b, unsigned n) {
- long long unsigned bitmask;
+ uint64_t bitmask;
unsigned offset;
assert(b);
@@ -95,7 +95,7 @@ int bitmap_set(Bitmap *b, unsigned n) {
}
void bitmap_unset(Bitmap *b, unsigned n) {
- long long unsigned bitmask;
+ uint64_t bitmask;
unsigned offset;
assert(b);
@@ -111,7 +111,7 @@ void bitmap_unset(Bitmap *b, unsigned n) {
}
bool bitmap_isset(Bitmap *b, unsigned n) {
- long long unsigned bitmask;
+ uint64_t bitmask;
unsigned offset;
if (!b || !b->bitmaps)
@@ -146,7 +146,7 @@ void bitmap_clear(Bitmap *b) {
}
bool bitmap_iterate(Bitmap *b, Iterator *i, unsigned *n) {
- long long unsigned bitmask;
+ uint64_t bitmask;
unsigned offset, rem;
if (!b || i->idx == BITMAP_END)