add function that finds a span of bits
This commit is contained in:
parent
9d3f87837b
commit
3ecaf1d521
2 changed files with 18 additions and 0 deletions
|
@ -112,10 +112,18 @@ void sparsemap_scan(sparsemap_t *map, void (*scanner)(sm_idx_t[], size_t),
|
||||||
reduces the chunk map-count appropriately. */
|
reduces the chunk map-count appropriately. */
|
||||||
void sparsemap_split(sparsemap_t *map, size_t sstart, sparsemap_t *other);
|
void sparsemap_split(sparsemap_t *map, size_t sstart, sparsemap_t *other);
|
||||||
|
|
||||||
|
#if 0 // TODO
|
||||||
|
/* Sets/clears bits starting at |ssize| in other in |map| possibly invoking the resize function. */
|
||||||
|
void sparsemap_combine(sparsemap_t *map, size_t sstart, sparsemap_t *other);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Returns the index of the n'th set bit; uses a 0-based index. */
|
/* Returns the index of the n'th set bit; uses a 0-based index. */
|
||||||
size_t sparsemap_select(sparsemap_t *map, size_t n);
|
size_t sparsemap_select(sparsemap_t *map, size_t n);
|
||||||
|
|
||||||
/* Counts the set bits in the range [offset, idx]. */
|
/* Counts the set bits in the range [offset, idx]. */
|
||||||
size_t sparsemap_rank(sparsemap_t *map, size_t offset, size_t idx);
|
size_t sparsemap_rank(sparsemap_t *map, size_t offset, size_t idx);
|
||||||
|
|
||||||
|
/* Returns the 0-based index of a span of the first set bits of at least |len| starting after |offset|. */
|
||||||
|
size_t sparsemap_span(sparsemap_t *map, size_t offset, size_t len);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1177,3 +1177,13 @@ sparsemap_rank(sparsemap_t *map, size_t offset, size_t idx)
|
||||||
}
|
}
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds a span of set bits of at least |len| after |offset|.
|
||||||
|
*/
|
||||||
|
size_t sparsemap_span(sparsemap_t *map, size_t offset, size_t len) {
|
||||||
|
((void)map);
|
||||||
|
((void)offset);
|
||||||
|
((void)len);
|
||||||
|
return 0; // TODO
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue