4#if !defined(SKIP_INCLUDES)
10#if !defined EXCLUSIVE_END_INDEX
11 #if !defined DC_PLACEHOLDERS
14 #define EXCLUSIVE_END_INDEX 32
21#define INDICES_CAPACITY EXCLUSIVE_END_INDEX
37#define INVARIANT_CHECK(self) DC_ASSUME(self);
55#if EXCLUSIVE_END_INDEX <= MAX_INDEX
66 self->bits[byte] = self->bits[byte] | mask;
68 self->bits[byte] = self->bits[byte] & (~mask);
76 "Failed to set index {index=%lu, value=%d, exclusive_end_index=%d}", (
size_t)index,
83#if EXCLUSIVE_END_INDEX <= MAX_INDEX
85 "Index out of bounds {index=%lu, exclusive_end_index=%d}", (
size_t)index,
92 return (self->bits[
byte] & mask) != 0;
102 if (
NS(
SELF,
get)(self, (INDEX_TYPE)index)) {
121 memcpy(&new_self.
bits, &self->bits,
sizeof(self->bits));
128 for (INDEX_TYPE
byte = 0;
130 size += (uint32_t)__builtin_popcount((
unsigned int)self->bits[
byte]);
141#if EXCLUSIVE_END_INDEX < MAX_INDEX
142 #define ITER_INDEX_TYPE INDEX_TYPE
144 #define ITER_INDEX_TYPE INDEX_LARGER_TYPE
147#define ITER_CONST NS(SELF, iter_const)
170 !
NS(
SELF,
get)(iter->bitset, (INDEX_TYPE)iter->next_index)) {
192 .next_index = next_index,
199#define ITER NS(SELF, iter)
222 !
NS(
SELF,
get)(iter->bitset, (INDEX_TYPE)iter->next_index)) {
244 .next_index = next_index,
250#undef ITER_INDEX_TYPE
251#undef INVARIANT_CHECK
256#undef INDICES_CAPACITY
257#undef EXCLUSIVE_END_INDEX
static DC_PUBLIC void debug(SELF const *self, dc_debug_fmt fmt, FILE *stream)
#define DC_STATIC_CONSTANT
#define DC_BITSET_STATIC_INDEX_TO_OFFSET(INDEX)
#define DC_BITSET_STATIC_CAPACITY_TO_BYTES(CAPACITY)
#define DC_BITSET_STATIC_INDEX_TO_BYTES(INDEX)
#define DC_BITSET_STATIC_OFFSET_TO_MASK(OFFSET)
#define INVARIANT_CHECK(self)
static DC_PUBLIC IV_PAIR next(ITER *iter)
static DC_PUBLIC bool empty(ITER const *iter)
static DC_PUBLIC bool empty_item(IV_PAIR const *item)
static DC_PUBLIC ITER get_iter(SELF *self)
static DC_PUBLIC ITER_CONST get_iter_const(SELF const *self)
static DC_PUBLIC size_t size(SELF const *self)
static DC_PUBLIC SELF clone(SELF const *self)
static DC_PUBLIC bool try_set(SELF *self, INDEX_TYPE index, bool value)
static DC_PUBLIC bool get(SELF const *self, INDEX_TYPE index)
static DC_PUBLIC void set(SELF *self, INDEX_TYPE index, bool value)
DC_STATIC_CONSTANT INDEX_TYPE max_index
#define EXCLUSIVE_END_INDEX
A simple bitset for indexes [0, EXCLUSIVE_END_INDEX), statically allocated.
DC_STATIC_CONSTANT INDEX_TYPE min_index
#define DC_TRAIT_BITSET(SELF)
#define TEMPLATE_ERROR(...)
With the user provided name, even in nested templates.
static DC_PUBLIC void dc_debug_fmt_print(dc_debug_fmt fmt, FILE *stream, const char *format,...)
static DC_PUBLIC dc_debug_fmt dc_debug_fmt_scope_end(dc_debug_fmt fmt)
static DC_PUBLIC dc_debug_fmt dc_debug_fmt_scope_begin(dc_debug_fmt fmt)
static DC_PUBLIC dc_gdb_marker dc_gdb_marker_new()
static DC_PUBLIC void mutation_tracker_mutate(mutation_tracker *self)
static DC_PUBLIC void mutation_version_check(mutation_version const *self)
static DC_PUBLIC mutation_tracker mutation_tracker_new()
static DC_PUBLIC mutation_version mutation_tracker_get(mutation_tracker const *self)
#define DC_EXPAND_STRING(NAME)
#define DC_ASSERT(expr,...)
#define DC_ASSUME(expr,...)
mutation_tracker iterator_invalidation_tracker
dc_gdb_marker derive_c_bitset_static
uint8_t bits[DC_BITSET_STATIC_CAPACITY_TO_BYTES(EXCLUSIVE_END_INDEX)]
Debug format helpers for debug printin data structures.
tracks a specific version of a value, so that this can be compared later to check modification For ex...
static DC_PUBLIC FILE * stream(SELF *self)