diff options
| author | Fabrice <fabrice@schaub-dev.xyz> | 2026-03-21 14:48:00 +0100 |
|---|---|---|
| committer | Fabrice <fabrice@schaub-dev.xyz> | 2026-03-21 14:48:04 +0100 |
| commit | 81b8c2a1a824a69aa03f3c532dc20fe6b7b36cee (patch) | |
| tree | 44bf0270e5f06aa9cef31e20982fb57215ca3ca5 /cheesemap.h | |
| parent | c7f50cfa517bdcbd6aa1021adc7c7305e9d89e1b (diff) | |
adding iterator
Diffstat (limited to 'cheesemap.h')
| -rw-r--r-- | cheesemap.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/cheesemap.h b/cheesemap.h index 8002fbb..f8991b1 100644 --- a/cheesemap.h +++ b/cheesemap.h @@ -129,12 +129,21 @@ struct cheesemap { void cm_new(struct cheesemap* map, uintptr_t key_size, uintptr_t value_size, uint8_t* mem_usr, cm_malloc_fn malloc, cm_free_fn free, uint8_t* map_usr, cm_hash_fn hash, cm_compare_fn compare); +void cm_drop(struct cheesemap* map); -static inline void cm_drop(struct cheesemap* map) { - assert(map != NULL); +//////////////////////////////// +// cheesemap iterators +// - cm_raw_drop(&map->raw, map->key_size, map->value_size, &map->fns); - memset(map, 0, sizeof(*map)); -} +struct cheesemap_raw_iter { + bitmask_t curr_mask; + uintptr_t curr_index; + uint8_t* n_ctrl; + uint8_t* n_entry; + uint8_t* end; +}; + +void cm_raw_iter_init(struct cheesemap_raw_iter* iter,const struct cheesemap_raw* map, uintptr_t entry_size, uintptr_t start_index); +bool cheesemap_raw_iter_next(struct cheesemap_raw_iter* iter, uintptr_t entry_size, uintptr_t* out_index); #endif |
