diff --git a/flat__hash__map_8h.html b/flat__hash__map_8h.html index 7b9f37d..1e626e5 100644 --- a/flat__hash__map_8h.html +++ b/flat__hash__map_8h.html @@ -141,9 +141,9 @@

Initialization Interface

Initialize the container with memory, callbacks, and permissions.

-#define ccc_fhm_init(memory_ptr, capacity, key_field, fhash_elem_field, alloc_fn, hash_fn, key_eq_fn, aux_data) - Initialize a map with a buffer of types at compile time or runtime.
-  +#define ccc_fhm_init(memory_ptr, capacity, fhash_elem_field, key_field, alloc_fn, hash_fn, key_eq_fn, aux_data) + Initialize a map with a buffer of types at compile time or runtime.
ccc_result ccc_fhm_copy (ccc_flat_hash_map *dst, ccc_flat_hash_map const *src, ccc_alloc_fn *fn)  Copy the map at source to destination.
  @@ -396,8 +396,8 @@

-

◆ ccc_fhm_init

+ +

◆ ccc_fhm_init

diff --git a/flat__hash__map_8h.js b/flat__hash__map_8h.js index 268a5c4..0be56a1 100644 --- a/flat__hash__map_8h.js +++ b/flat__hash__map_8h.js @@ -2,7 +2,7 @@ var flat__hash__map_8h = [ [ "ccc_fhm_and_modify_w", "flat__hash__map_8h.html#a4a6693a6c7d797a7552deb4d7e7ae172", null ], [ "ccc_fhm_entry_r", "flat__hash__map_8h.html#a90450f8ab0e3ed9356a35ec8d74b7b5e", null ], - [ "ccc_fhm_init", "flat__hash__map_8h.html#af26e0aac66a113372ffd845e7f3b5d5f", null ], + [ "ccc_fhm_init", "flat__hash__map_8h.html#abc59d084e446d793cbb386f9486e4bcc", null ], [ "ccc_fhm_insert_entry_w", "flat__hash__map_8h.html#a726c7b51ef2288a25cc9fc8e6d75bd22", null ], [ "ccc_fhm_insert_or_assign_r", "flat__hash__map_8h.html#a70aa536cda96d4572e3d9d4e12fee0e3", null ], [ "ccc_fhm_insert_or_assign_w", "flat__hash__map_8h.html#a2499a64637dc03b73ecf141ac29e7da5", null ], diff --git a/flat__hash__map_8h_source.html b/flat__hash__map_8h_source.html index 4ea920f..2b168b0 100644 --- a/flat__hash__map_8h_source.html +++ b/flat__hash__map_8h_source.html @@ -107,9 +107,9 @@
46
51typedef union ccc_fhmap_entry_ ccc_fhmap_entry;
52
-
72#define ccc_fhm_init(memory_ptr, capacity, key_field, fhash_elem_field, \
+
72#define ccc_fhm_init(memory_ptr, capacity, fhash_elem_field, key_field, \
73 alloc_fn, hash_fn, key_eq_fn, aux_data) \
-
74 ccc_impl_fhm_init(memory_ptr, capacity, key_field, fhash_elem_field, \
+
74 ccc_impl_fhm_init(memory_ptr, capacity, fhash_elem_field, key_field, \
75 alloc_fn, hash_fn, key_eq_fn, aux_data)
76
diff --git a/globals.html b/globals.html index 51033f5..f3d855f 100644 --- a/globals.html +++ b/globals.html @@ -226,7 +226,7 @@

- c -

  • ccc_fhm_entry_r : flat_hash_map.h
  • ccc_fhm_entry_status() : flat_hash_map.h
  • ccc_fhm_get_key_val() : flat_hash_map.h
  • -
  • ccc_fhm_init : flat_hash_map.h
  • +
  • ccc_fhm_init : flat_hash_map.h
  • ccc_fhm_insert() : flat_hash_map.h
  • ccc_fhm_insert_entry() : flat_hash_map.h
  • ccc_fhm_insert_entry_w : flat_hash_map.h
  • diff --git a/globals_defs.html b/globals_defs.html index 55ff33e..8919654 100644 --- a/globals_defs.html +++ b/globals_defs.html @@ -118,7 +118,7 @@

    - c -

    • ccc_fdeq_init : flat_double_ended_queue.h
    • ccc_fhm_and_modify_w : flat_hash_map.h
    • ccc_fhm_entry_r : flat_hash_map.h
    • -
    • ccc_fhm_init : flat_hash_map.h
    • +
    • ccc_fhm_init : flat_hash_map.h
    • ccc_fhm_insert_entry_w : flat_hash_map.h
    • ccc_fhm_insert_or_assign_r : flat_hash_map.h
    • ccc_fhm_insert_or_assign_w : flat_hash_map.h
    • diff --git a/impl__flat__hash__map_8h_source.html b/impl__flat__hash__map_8h_source.html index aca83fc..1211d0f 100644 --- a/impl__flat__hash__map_8h_source.html +++ b/impl__flat__hash__map_8h_source.html @@ -135,7 +135,7 @@
      48 struct ccc_fhash_entry_ impl_;
      49};
      50
      -
      51#define ccc_impl_fhm_init(memory_ptr, capacity, key_field, fhash_elem_field, \
      +
      51#define ccc_impl_fhm_init(memory_ptr, capacity, fhash_elem_field, key_field, \
      52 alloc_fn, hash_fn, key_eq_fn, aux) \
      53 { \
      54 .buf_ \
      @@ -147,239 +147,217 @@
      60 = offsetof(typeof(*(memory_ptr)), fhash_elem_field), \
      61 }
      62
      -
      63#define ccc_impl_fhm_zero_init(type_name, key_field, fhash_elem_field, \
      -
      64 alloc_fn, hash_fn, key_eq_fn, aux) \
      -
      65 { \
      -
      66 .buf_ = ccc_buf_init((type_name *)NULL, alloc_fn, aux, 0), \
      -
      67 .hash_fn_ = (hash_fn), \
      -
      68 .eq_fn_ = (key_eq_fn), \
      -
      69 .key_offset_ = (offsetof(type_name, key_field)), \
      -
      70 .hash_elem_offset_ = offsetof(type_name, fhash_elem_field), \
      -
      71 }
      -
      72
      -
      73#define ccc_impl_fhm_static_init(memory_ptr, key_field, fhash_elem_field, \
      -
      74 hash_fn, key_eq_fn, aux) \
      -
      75 { \
      -
      76 .buf_ = ccc_buf_init(memory_ptr, NULL, aux, \
      -
      77 sizeof(memory_ptr) / sizeof((memory_ptr)[0])), \
      -
      78 .hash_fn_ = (hash_fn), \
      -
      79 .eq_fn_ = (key_eq_fn), \
      -
      80 .key_offset_ = (offsetof(typeof(*(memory_ptr)), key_field)), \
      -
      81 .hash_elem_offset_ \
      -
      82 = offsetof(typeof(*(memory_ptr)), fhash_elem_field), \
      -
      83 }
      -
      84
      -
      85struct ccc_ent_ ccc_impl_fhm_find(struct ccc_fhmap_ const *, void const *key,
      -
      86 uint64_t hash);
      -
      87void ccc_impl_fhm_insert(struct ccc_fhmap_ *h, void const *e, uint64_t hash,
      -
      88 size_t cur_i);
      -
      89
      -
      90struct ccc_fhash_entry_ ccc_impl_fhm_entry(struct ccc_fhmap_ *h,
      -
      91 void const *key);
      -
      92struct ccc_fhash_entry_ *ccc_impl_fhm_and_modify(struct ccc_fhash_entry_ *e,
      -
      93 ccc_update_fn *fn);
      -
      94struct ccc_fhmap_elem_ *ccc_impl_fhm_in_slot(struct ccc_fhmap_ const *h,
      -
      95 void const *slot);
      -
      96void *ccc_impl_fhm_key_in_slot(struct ccc_fhmap_ const *h, void const *slot);
      -
      97uint64_t *ccc_impl_fhm_hash_at(struct ccc_fhmap_ const *h, size_t i);
      -
      98size_t ccc_impl_fhm_distance(size_t capacity, size_t i, size_t j);
      -
      99ccc_result ccc_impl_fhm_maybe_resize(struct ccc_fhmap_ *);
      -
      100uint64_t ccc_impl_fhm_filter(struct ccc_fhmap_ const *, void const *key);
      -
      101void *ccc_impl_fhm_base(struct ccc_fhmap_ const *h);
      -
      102size_t ccc_impl_fhm_increment(size_t capacity, size_t i);
      -
      103
      -
      104/* NOLINTBEGIN(readability-identifier-naming) */
      -
      105
      -
      106/*================== Helper Macros for Repeated Logic =================*/
      -
      107
      -
      108/* Internal helper assumes that swap_entry has already been evaluated once
      -
      109 which it must have to make it to this point. */
      -
      110#define ccc_impl_fhm_swaps(swap_entry, lazy_key_value...) \
      -
      111 (__extension__({ \
      -
      112 size_t fhm_i_ \
      -
      113 = ccc_buf_i(&((swap_entry)->h_->buf_), (swap_entry)->entry_.e_); \
      -
      114 if (*ccc_impl_fhm_hash_at((swap_entry)->h_, fhm_i_) == CCC_FHM_EMPTY) \
      -
      115 { \
      -
      116 *((typeof(lazy_key_value) *)ccc_buf_at(&((swap_entry)->h_->buf_), \
      -
      117 fhm_i_)) \
      -
      118 = lazy_key_value; \
      -
      119 *ccc_impl_fhm_hash_at((swap_entry)->h_, fhm_i_) \
      -
      120 = (swap_entry)->hash_; \
      -
      121 (void)ccc_buf_size_plus(&(swap_entry)->h_->buf_, 1); \
      -
      122 } \
      -
      123 else \
      -
      124 { \
      -
      125 typeof(lazy_key_value) fhm_cur_slot_ \
      -
      126 = *((typeof(fhm_cur_slot_) *)ccc_buf_at( \
      -
      127 &((swap_entry)->h_->buf_), fhm_i_)); \
      -
      128 *((typeof(fhm_cur_slot_) *)ccc_buf_at(&((swap_entry)->h_->buf_), \
      -
      129 fhm_i_)) \
      -
      130 = lazy_key_value; \
      -
      131 *ccc_impl_fhm_hash_at((swap_entry)->h_, fhm_i_) \
      -
      132 = (swap_entry)->hash_; \
      -
      133 fhm_i_ = ccc_impl_fhm_increment( \
      -
      134 ccc_buf_capacity(&(swap_entry)->h_->buf_), fhm_i_); \
      -
      135 ccc_impl_fhm_insert( \
      -
      136 (swap_entry)->h_, &fhm_cur_slot_, \
      -
      137 ccc_impl_fhm_in_slot((swap_entry)->h_, &fhm_cur_slot_)->hash_, \
      -
      138 fhm_i_); \
      -
      139 } \
      -
      140 (swap_entry)->entry_.e_; \
      -
      141 }))
      -
      142
      -
      143/*===================== Core Macro Implementations ==================*/
      -
      144
      -
      145#define ccc_impl_fhm_and_modify_w(flat_hash_map_entry_ptr, type_name, \
      -
      146 closure_over_T...) \
      -
      147 (__extension__({ \
      -
      148 __auto_type fhm_mod_ent_ptr_ = (flat_hash_map_entry_ptr); \
      -
      149 struct ccc_fhash_entry_ fhm_mod_with_ent_ \
      -
      150 = {.entry_ = {.stats_ = CCC_ENTRY_INPUT_ERROR}}; \
      -
      151 if (fhm_mod_ent_ptr_) \
      -
      152 { \
      -
      153 fhm_mod_with_ent_ = fhm_mod_ent_ptr_->impl_; \
      -
      154 if (fhm_mod_with_ent_.entry_.stats_ == CCC_ENTRY_OCCUPIED) \
      -
      155 { \
      -
      156 type_name *const T = fhm_mod_with_ent_.entry_.e_; \
      -
      157 if (T) \
      -
      158 { \
      -
      159 closure_over_T \
      -
      160 } \
      -
      161 } \
      -
      162 } \
      -
      163 fhm_mod_with_ent_; \
      -
      164 }))
      -
      165
      -
      166#define ccc_impl_fhm_or_insert_w(flat_hash_map_entry_ptr, lazy_key_value...) \
      -
      167 (__extension__({ \
      -
      168 __auto_type fhm_or_ins_ent_ptr_ = (flat_hash_map_entry_ptr); \
      -
      169 typeof(lazy_key_value) *fhm_or_ins_res_ = NULL; \
      -
      170 if (fhm_or_ins_ent_ptr_) \
      -
      171 { \
      -
      172 struct ccc_fhash_entry_ *fhm_or_ins_entry_ \
      -
      173 = &fhm_or_ins_ent_ptr_->impl_; \
      -
      174 if (!(fhm_or_ins_entry_->entry_.stats_ & CCC_ENTRY_INSERT_ERROR)) \
      -
      175 { \
      -
      176 if (fhm_or_ins_entry_->entry_.stats_ & CCC_ENTRY_OCCUPIED) \
      -
      177 { \
      -
      178 fhm_or_ins_res_ = fhm_or_ins_entry_->entry_.e_; \
      -
      179 } \
      -
      180 else \
      -
      181 { \
      -
      182 fhm_or_ins_res_ = ccc_impl_fhm_swaps(fhm_or_ins_entry_, \
      -
      183 lazy_key_value); \
      -
      184 } \
      -
      185 } \
      -
      186 } \
      -
      187 fhm_or_ins_res_; \
      -
      188 }))
      -
      189
      -
      190#define ccc_impl_fhm_insert_entry_w(flat_hash_map_entry_ptr, \
      -
      191 lazy_key_value...) \
      -
      192 (__extension__({ \
      -
      193 __auto_type fhm_ins_ent_ptr_ = (flat_hash_map_entry_ptr); \
      -
      194 typeof(lazy_key_value) *fhm_res_ = NULL; \
      -
      195 if (fhm_ins_ent_ptr_) \
      -
      196 { \
      -
      197 struct ccc_fhash_entry_ *fhm_ins_ent_ = &fhm_ins_ent_ptr_->impl_; \
      -
      198 if (!(fhm_ins_ent_->entry_.stats_ & CCC_ENTRY_INSERT_ERROR)) \
      -
      199 { \
      -
      200 if (fhm_ins_ent_->entry_.stats_ & CCC_ENTRY_OCCUPIED) \
      -
      201 { \
      -
      202 fhm_ins_ent_->entry_.stats_ = CCC_ENTRY_OCCUPIED; \
      -
      203 *((typeof(fhm_res_))fhm_ins_ent_->entry_.e_) \
      -
      204 = lazy_key_value; \
      -
      205 ccc_impl_fhm_in_slot(fhm_ins_ent_->h_, \
      -
      206 fhm_ins_ent_->entry_.e_) \
      -
      207 ->hash_ \
      -
      208 = fhm_ins_ent_->hash_; \
      -
      209 fhm_res_ = fhm_ins_ent_->entry_.e_; \
      -
      210 } \
      -
      211 else \
      -
      212 { \
      -
      213 fhm_res_ \
      -
      214 = ccc_impl_fhm_swaps(fhm_ins_ent_, lazy_key_value); \
      -
      215 } \
      -
      216 } \
      -
      217 } \
      -
      218 fhm_res_; \
      -
      219 }))
      -
      220
      -
      221#define ccc_impl_fhm_try_insert_w(flat_hash_map_ptr, key, lazy_value...) \
      -
      222 (__extension__({ \
      -
      223 struct ccc_fhmap_ *flat_hash_map_ptr_ = (flat_hash_map_ptr); \
      -
      224 struct ccc_ent_ fhm_try_insert_res_ \
      -
      225 = {.stats_ = CCC_ENTRY_INPUT_ERROR}; \
      -
      226 if (flat_hash_map_ptr_) \
      -
      227 { \
      -
      228 __auto_type fhm_key_ = key; \
      -
      229 struct ccc_fhash_entry_ fhm_try_ins_ent_ \
      -
      230 = ccc_impl_fhm_entry(flat_hash_map_ptr_, (void *)&fhm_key_); \
      -
      231 if ((fhm_try_ins_ent_.entry_.stats_ & CCC_ENTRY_OCCUPIED) \
      -
      232 || (fhm_try_ins_ent_.entry_.stats_ & CCC_ENTRY_INSERT_ERROR)) \
      -
      233 { \
      -
      234 fhm_try_insert_res_ = fhm_try_ins_ent_.entry_; \
      -
      235 } \
      -
      236 else \
      -
      237 { \
      -
      238 fhm_try_insert_res_ = (struct ccc_ent_){ \
      -
      239 ccc_impl_fhm_swaps((&fhm_try_ins_ent_), lazy_value), \
      -
      240 CCC_ENTRY_VACANT, \
      -
      241 }; \
      -
      242 *((typeof(fhm_key_) *)ccc_impl_fhm_key_in_slot( \
      -
      243 flat_hash_map_ptr_, fhm_try_insert_res_.e_)) \
      -
      244 = fhm_key_; \
      -
      245 } \
      -
      246 } \
      -
      247 fhm_try_insert_res_; \
      -
      248 }))
      -
      249
      -
      250#define ccc_impl_fhm_insert_or_assign_w(flat_hash_map_ptr, key, lazy_value...) \
      -
      251 (__extension__({ \
      -
      252 struct ccc_fhmap_ *flat_hash_map_ptr_ = (flat_hash_map_ptr); \
      -
      253 struct ccc_ent_ fhm_ins_or_assign_res_ \
      -
      254 = {.stats_ = CCC_ENTRY_INPUT_ERROR}; \
      -
      255 if (flat_hash_map_ptr_) \
      -
      256 { \
      -
      257 __auto_type fhm_key_ = key; \
      -
      258 struct ccc_fhash_entry_ fhm_ins_or_assign_ent_ \
      -
      259 = ccc_impl_fhm_entry(flat_hash_map_ptr_, (void *)&fhm_key_); \
      -
      260 if (fhm_ins_or_assign_ent_.entry_.stats_ & CCC_ENTRY_OCCUPIED) \
      -
      261 { \
      -
      262 fhm_ins_or_assign_res_ = fhm_ins_or_assign_ent_.entry_; \
      -
      263 *((typeof(lazy_value) *)fhm_ins_or_assign_res_.e_) \
      -
      264 = lazy_value; \
      -
      265 *((typeof(fhm_key_) *)ccc_impl_fhm_key_in_slot( \
      -
      266 flat_hash_map_ptr_, fhm_ins_or_assign_res_.e_)) \
      -
      267 = fhm_key_; \
      -
      268 ccc_impl_fhm_in_slot(fhm_ins_or_assign_ent_.h_, \
      -
      269 fhm_ins_or_assign_ent_.entry_.e_) \
      -
      270 ->hash_ \
      -
      271 = fhm_ins_or_assign_ent_.hash_; \
      -
      272 } \
      -
      273 else if (fhm_ins_or_assign_ent_.entry_.stats_ \
      -
      274 & CCC_ENTRY_INSERT_ERROR) \
      -
      275 { \
      -
      276 fhm_ins_or_assign_res_.e_ = NULL; \
      -
      277 fhm_ins_or_assign_res_.stats_ = CCC_ENTRY_INSERT_ERROR; \
      -
      278 } \
      -
      279 else \
      -
      280 { \
      -
      281 fhm_ins_or_assign_res_ = (struct ccc_ent_){ \
      -
      282 ccc_impl_fhm_swaps((&fhm_ins_or_assign_ent_), lazy_value), \
      -
      283 CCC_ENTRY_VACANT, \
      -
      284 }; \
      -
      285 *((typeof(fhm_key_) *)ccc_impl_fhm_key_in_slot( \
      -
      286 flat_hash_map_ptr_, fhm_ins_or_assign_res_.e_)) \
      -
      287 = fhm_key_; \
      -
      288 } \
      -
      289 } \
      -
      290 fhm_ins_or_assign_res_; \
      -
      291 }))
      -
      292
      -
      293/* NOLINTEND(readability-identifier-naming) */
      -
      294
      -
      295#endif /* CCC_IMPL_FLAT_HASH_MAP_H */
      +
      63struct ccc_ent_ ccc_impl_fhm_find(struct ccc_fhmap_ const *, void const *key,
      +
      64 uint64_t hash);
      +
      65void ccc_impl_fhm_insert(struct ccc_fhmap_ *h, void const *e, uint64_t hash,
      +
      66 size_t cur_i);
      +
      67
      +
      68struct ccc_fhash_entry_ ccc_impl_fhm_entry(struct ccc_fhmap_ *h,
      +
      69 void const *key);
      +
      70struct ccc_fhash_entry_ *ccc_impl_fhm_and_modify(struct ccc_fhash_entry_ *e,
      +
      71 ccc_update_fn *fn);
      +
      72struct ccc_fhmap_elem_ *ccc_impl_fhm_in_slot(struct ccc_fhmap_ const *h,
      +
      73 void const *slot);
      +
      74void *ccc_impl_fhm_key_in_slot(struct ccc_fhmap_ const *h, void const *slot);
      +
      75uint64_t *ccc_impl_fhm_hash_at(struct ccc_fhmap_ const *h, size_t i);
      +
      76size_t ccc_impl_fhm_distance(size_t capacity, size_t i, size_t j);
      +
      77ccc_result ccc_impl_fhm_maybe_resize(struct ccc_fhmap_ *);
      +
      78uint64_t ccc_impl_fhm_filter(struct ccc_fhmap_ const *, void const *key);
      +
      79void *ccc_impl_fhm_base(struct ccc_fhmap_ const *h);
      +
      80size_t ccc_impl_fhm_increment(size_t capacity, size_t i);
      +
      81
      +
      82/* NOLINTBEGIN(readability-identifier-naming) */
      +
      83
      +
      84/*================== Helper Macros for Repeated Logic =================*/
      +
      85
      +
      86/* Internal helper assumes that swap_entry has already been evaluated once
      +
      87 which it must have to make it to this point. */
      +
      88#define ccc_impl_fhm_swaps(swap_entry, lazy_key_value...) \
      +
      89 (__extension__({ \
      +
      90 size_t fhm_i_ \
      +
      91 = ccc_buf_i(&((swap_entry)->h_->buf_), (swap_entry)->entry_.e_); \
      +
      92 if (*ccc_impl_fhm_hash_at((swap_entry)->h_, fhm_i_) == CCC_FHM_EMPTY) \
      +
      93 { \
      +
      94 *((typeof(lazy_key_value) *)ccc_buf_at(&((swap_entry)->h_->buf_), \
      +
      95 fhm_i_)) \
      +
      96 = lazy_key_value; \
      +
      97 *ccc_impl_fhm_hash_at((swap_entry)->h_, fhm_i_) \
      +
      98 = (swap_entry)->hash_; \
      +
      99 (void)ccc_buf_size_plus(&(swap_entry)->h_->buf_, 1); \
      +
      100 } \
      +
      101 else \
      +
      102 { \
      +
      103 typeof(lazy_key_value) fhm_cur_slot_ \
      +
      104 = *((typeof(fhm_cur_slot_) *)ccc_buf_at( \
      +
      105 &((swap_entry)->h_->buf_), fhm_i_)); \
      +
      106 *((typeof(fhm_cur_slot_) *)ccc_buf_at(&((swap_entry)->h_->buf_), \
      +
      107 fhm_i_)) \
      +
      108 = lazy_key_value; \
      +
      109 *ccc_impl_fhm_hash_at((swap_entry)->h_, fhm_i_) \
      +
      110 = (swap_entry)->hash_; \
      +
      111 fhm_i_ = ccc_impl_fhm_increment( \
      +
      112 ccc_buf_capacity(&(swap_entry)->h_->buf_), fhm_i_); \
      +
      113 ccc_impl_fhm_insert( \
      +
      114 (swap_entry)->h_, &fhm_cur_slot_, \
      +
      115 ccc_impl_fhm_in_slot((swap_entry)->h_, &fhm_cur_slot_)->hash_, \
      +
      116 fhm_i_); \
      +
      117 } \
      +
      118 (swap_entry)->entry_.e_; \
      +
      119 }))
      +
      120
      +
      121/*===================== Core Macro Implementations ==================*/
      +
      122
      +
      123#define ccc_impl_fhm_and_modify_w(flat_hash_map_entry_ptr, type_name, \
      +
      124 closure_over_T...) \
      +
      125 (__extension__({ \
      +
      126 __auto_type fhm_mod_ent_ptr_ = (flat_hash_map_entry_ptr); \
      +
      127 struct ccc_fhash_entry_ fhm_mod_with_ent_ \
      +
      128 = {.entry_ = {.stats_ = CCC_ENTRY_INPUT_ERROR}}; \
      +
      129 if (fhm_mod_ent_ptr_) \
      +
      130 { \
      +
      131 fhm_mod_with_ent_ = fhm_mod_ent_ptr_->impl_; \
      +
      132 if (fhm_mod_with_ent_.entry_.stats_ == CCC_ENTRY_OCCUPIED) \
      +
      133 { \
      +
      134 type_name *const T = fhm_mod_with_ent_.entry_.e_; \
      +
      135 if (T) \
      +
      136 { \
      +
      137 closure_over_T \
      +
      138 } \
      +
      139 } \
      +
      140 } \
      +
      141 fhm_mod_with_ent_; \
      +
      142 }))
      +
      143
      +
      144#define ccc_impl_fhm_or_insert_w(flat_hash_map_entry_ptr, lazy_key_value...) \
      +
      145 (__extension__({ \
      +
      146 __auto_type fhm_or_ins_ent_ptr_ = (flat_hash_map_entry_ptr); \
      +
      147 typeof(lazy_key_value) *fhm_or_ins_res_ = NULL; \
      +
      148 if (fhm_or_ins_ent_ptr_) \
      +
      149 { \
      +
      150 struct ccc_fhash_entry_ *fhm_or_ins_entry_ \
      +
      151 = &fhm_or_ins_ent_ptr_->impl_; \
      +
      152 if (!(fhm_or_ins_entry_->entry_.stats_ & CCC_ENTRY_INSERT_ERROR)) \
      +
      153 { \
      +
      154 if (fhm_or_ins_entry_->entry_.stats_ & CCC_ENTRY_OCCUPIED) \
      +
      155 { \
      +
      156 fhm_or_ins_res_ = fhm_or_ins_entry_->entry_.e_; \
      +
      157 } \
      +
      158 else \
      +
      159 { \
      +
      160 fhm_or_ins_res_ = ccc_impl_fhm_swaps(fhm_or_ins_entry_, \
      +
      161 lazy_key_value); \
      +
      162 } \
      +
      163 } \
      +
      164 } \
      +
      165 fhm_or_ins_res_; \
      +
      166 }))
      +
      167
      +
      168#define ccc_impl_fhm_insert_entry_w(flat_hash_map_entry_ptr, \
      +
      169 lazy_key_value...) \
      +
      170 (__extension__({ \
      +
      171 __auto_type fhm_ins_ent_ptr_ = (flat_hash_map_entry_ptr); \
      +
      172 typeof(lazy_key_value) *fhm_res_ = NULL; \
      +
      173 if (fhm_ins_ent_ptr_) \
      +
      174 { \
      +
      175 struct ccc_fhash_entry_ *fhm_ins_ent_ = &fhm_ins_ent_ptr_->impl_; \
      +
      176 if (!(fhm_ins_ent_->entry_.stats_ & CCC_ENTRY_INSERT_ERROR)) \
      +
      177 { \
      +
      178 if (fhm_ins_ent_->entry_.stats_ & CCC_ENTRY_OCCUPIED) \
      +
      179 { \
      +
      180 fhm_ins_ent_->entry_.stats_ = CCC_ENTRY_OCCUPIED; \
      +
      181 *((typeof(fhm_res_))fhm_ins_ent_->entry_.e_) \
      +
      182 = lazy_key_value; \
      +
      183 ccc_impl_fhm_in_slot(fhm_ins_ent_->h_, \
      +
      184 fhm_ins_ent_->entry_.e_) \
      +
      185 ->hash_ \
      +
      186 = fhm_ins_ent_->hash_; \
      +
      187 fhm_res_ = fhm_ins_ent_->entry_.e_; \
      +
      188 } \
      +
      189 else \
      +
      190 { \
      +
      191 fhm_res_ \
      +
      192 = ccc_impl_fhm_swaps(fhm_ins_ent_, lazy_key_value); \
      +
      193 } \
      +
      194 } \
      +
      195 } \
      +
      196 fhm_res_; \
      +
      197 }))
      +
      198
      +
      199#define ccc_impl_fhm_try_insert_w(flat_hash_map_ptr, key, lazy_value...) \
      +
      200 (__extension__({ \
      +
      201 struct ccc_fhmap_ *flat_hash_map_ptr_ = (flat_hash_map_ptr); \
      +
      202 struct ccc_ent_ fhm_try_insert_res_ \
      +
      203 = {.stats_ = CCC_ENTRY_INPUT_ERROR}; \
      +
      204 if (flat_hash_map_ptr_) \
      +
      205 { \
      +
      206 __auto_type fhm_key_ = key; \
      +
      207 struct ccc_fhash_entry_ fhm_try_ins_ent_ \
      +
      208 = ccc_impl_fhm_entry(flat_hash_map_ptr_, (void *)&fhm_key_); \
      +
      209 if ((fhm_try_ins_ent_.entry_.stats_ & CCC_ENTRY_OCCUPIED) \
      +
      210 || (fhm_try_ins_ent_.entry_.stats_ & CCC_ENTRY_INSERT_ERROR)) \
      +
      211 { \
      +
      212 fhm_try_insert_res_ = fhm_try_ins_ent_.entry_; \
      +
      213 } \
      +
      214 else \
      +
      215 { \
      +
      216 fhm_try_insert_res_ = (struct ccc_ent_){ \
      +
      217 ccc_impl_fhm_swaps((&fhm_try_ins_ent_), lazy_value), \
      +
      218 CCC_ENTRY_VACANT, \
      +
      219 }; \
      +
      220 *((typeof(fhm_key_) *)ccc_impl_fhm_key_in_slot( \
      +
      221 flat_hash_map_ptr_, fhm_try_insert_res_.e_)) \
      +
      222 = fhm_key_; \
      +
      223 } \
      +
      224 } \
      +
      225 fhm_try_insert_res_; \
      +
      226 }))
      +
      227
      +
      228#define ccc_impl_fhm_insert_or_assign_w(flat_hash_map_ptr, key, lazy_value...) \
      +
      229 (__extension__({ \
      +
      230 struct ccc_fhmap_ *flat_hash_map_ptr_ = (flat_hash_map_ptr); \
      +
      231 struct ccc_ent_ fhm_ins_or_assign_res_ \
      +
      232 = {.stats_ = CCC_ENTRY_INPUT_ERROR}; \
      +
      233 if (flat_hash_map_ptr_) \
      +
      234 { \
      +
      235 __auto_type fhm_key_ = key; \
      +
      236 struct ccc_fhash_entry_ fhm_ins_or_assign_ent_ \
      +
      237 = ccc_impl_fhm_entry(flat_hash_map_ptr_, (void *)&fhm_key_); \
      +
      238 if (fhm_ins_or_assign_ent_.entry_.stats_ & CCC_ENTRY_OCCUPIED) \
      +
      239 { \
      +
      240 fhm_ins_or_assign_res_ = fhm_ins_or_assign_ent_.entry_; \
      +
      241 *((typeof(lazy_value) *)fhm_ins_or_assign_res_.e_) \
      +
      242 = lazy_value; \
      +
      243 *((typeof(fhm_key_) *)ccc_impl_fhm_key_in_slot( \
      +
      244 flat_hash_map_ptr_, fhm_ins_or_assign_res_.e_)) \
      +
      245 = fhm_key_; \
      +
      246 ccc_impl_fhm_in_slot(fhm_ins_or_assign_ent_.h_, \
      +
      247 fhm_ins_or_assign_ent_.entry_.e_) \
      +
      248 ->hash_ \
      +
      249 = fhm_ins_or_assign_ent_.hash_; \
      +
      250 } \
      +
      251 else if (fhm_ins_or_assign_ent_.entry_.stats_ \
      +
      252 & CCC_ENTRY_INSERT_ERROR) \
      +
      253 { \
      +
      254 fhm_ins_or_assign_res_.e_ = NULL; \
      +
      255 fhm_ins_or_assign_res_.stats_ = CCC_ENTRY_INSERT_ERROR; \
      +
      256 } \
      +
      257 else \
      +
      258 { \
      +
      259 fhm_ins_or_assign_res_ = (struct ccc_ent_){ \
      +
      260 ccc_impl_fhm_swaps((&fhm_ins_or_assign_ent_), lazy_value), \
      +
      261 CCC_ENTRY_VACANT, \
      +
      262 }; \
      +
      263 *((typeof(fhm_key_) *)ccc_impl_fhm_key_in_slot( \
      +
      264 flat_hash_map_ptr_, fhm_ins_or_assign_res_.e_)) \
      +
      265 = fhm_key_; \
      +
      266 } \
      +
      267 } \
      +
      268 fhm_ins_or_assign_res_; \
      +
      269 }))
      +
      270
      +
      271/* NOLINTEND(readability-identifier-naming) */
      +
      272
      +
      273#endif /* CCC_IMPL_FLAT_HASH_MAP_H */
      struct ccc_buf_ ccc_buffer
      A contiguous block of storage for elements of the same type.
      Definition: buffer.h:47
      uint64_t ccc_hash_fn(ccc_user_key to_hash)
      A callback function to hash the key type used in a container.
      Definition: types.h:249
      ccc_result
      A result of actions on containers.
      Definition: types.h:61
      diff --git a/navtreeindex0.js b/navtreeindex0.js index e33db55..ab7779c 100644 --- a/navtreeindex0.js +++ b/navtreeindex0.js @@ -130,6 +130,7 @@ var NAVTREEINDEX0 = "flat__hash__map_8h.html#ab3a078263d05afaac040fd318dda51ae":[11,0,0,4,11], "flat__hash__map_8h.html#ab3e7d1da422626b8f3624fb50e461331":[11,0,0,4,9], "flat__hash__map_8h.html#aba9e915d0b006d759c55689c27731829":[11,0,0,4,40], +"flat__hash__map_8h.html#abc59d084e446d793cbb386f9486e4bcc":[11,0,0,4,2], "flat__hash__map_8h.html#abcb080315f7f8b5f7db0570a5e2ed69e":[11,0,0,4,30], "flat__hash__map_8h.html#ad8c4a0948272d97ceb1d8219388aedeb":[11,0,0,4,38], "flat__hash__map_8h.html#ada2d334ae54ac456f5ff1a37ac546994":[11,0,0,4,12], @@ -140,7 +141,6 @@ var NAVTREEINDEX0 = "flat__hash__map_8h.html#ae6ddbf73bfeed2721c35d7a374edf7c1":[11,0,0,4,41], "flat__hash__map_8h.html#aec9935488ddcd22310213b4da852dd3b":[11,0,0,4,42], "flat__hash__map_8h.html#aefcfb8e4e21401e417bac1f3921606b4":[11,0,0,4,13], -"flat__hash__map_8h.html#af26e0aac66a113372ffd845e7f3b5d5f":[11,0,0,4,2], "flat__hash__map_8h.html#af55bfc47534f55c0c1ccddfc461a651d":[11,0,0,4,18], "flat__hash__map_8h.html#af8251d1f96c8a10e8ff2b20d7f117447":[11,0,0,4,14], "flat__hash__map_8h.html#afa2b797b90c223882d91781d56f3351e":[11,0,0,4,23], diff --git a/search/all_2.js b/search/all_2.js index a44aa40..d25160a 100644 --- a/search/all_2.js +++ b/search/all_2.js @@ -135,7 +135,7 @@ var searchData= ['ccc_5ffhm_5fentry_5fr_132',['ccc_fhm_entry_r',['../flat__hash__map_8h.html#a90450f8ab0e3ed9356a35ec8d74b7b5e',1,'flat_hash_map.h']]], ['ccc_5ffhm_5fentry_5fstatus_133',['ccc_fhm_entry_status',['../flat__hash__map_8h.html#a5b8c4131b6b6a3da6402aa820de8ff27',1,'flat_hash_map.h']]], ['ccc_5ffhm_5fget_5fkey_5fval_134',['ccc_fhm_get_key_val',['../flat__hash__map_8h.html#aaabf7c72514d440050daea0103552091',1,'flat_hash_map.h']]], - ['ccc_5ffhm_5finit_135',['ccc_fhm_init',['../flat__hash__map_8h.html#af26e0aac66a113372ffd845e7f3b5d5f',1,'flat_hash_map.h']]], + ['ccc_5ffhm_5finit_135',['ccc_fhm_init',['../flat__hash__map_8h.html#abc59d084e446d793cbb386f9486e4bcc',1,'flat_hash_map.h']]], ['ccc_5ffhm_5finsert_136',['ccc_fhm_insert',['../flat__hash__map_8h.html#a2ec093ccb5aebe169405f9514ec64188',1,'flat_hash_map.h']]], ['ccc_5ffhm_5finsert_5fentry_137',['ccc_fhm_insert_entry',['../flat__hash__map_8h.html#a516fb468afdcff82caade184337560ee',1,'flat_hash_map.h']]], ['ccc_5ffhm_5finsert_5fentry_5fw_138',['ccc_fhm_insert_entry_w',['../flat__hash__map_8h.html#a726c7b51ef2288a25cc9fc8e6d75bd22',1,'flat_hash_map.h']]], diff --git a/search/defines_0.js b/search/defines_0.js index b65b00d..b8eb238 100644 --- a/search/defines_0.js +++ b/search/defines_0.js @@ -25,7 +25,7 @@ var searchData= ['ccc_5ffdeq_5finit_22',['ccc_fdeq_init',['../flat__double__ended__queue_8h.html#a5f6c51ae30c8f0cae6e1b05466008784',1,'flat_double_ended_queue.h']]], ['ccc_5ffhm_5fand_5fmodify_5fw_23',['ccc_fhm_and_modify_w',['../flat__hash__map_8h.html#a4a6693a6c7d797a7552deb4d7e7ae172',1,'flat_hash_map.h']]], ['ccc_5ffhm_5fentry_5fr_24',['ccc_fhm_entry_r',['../flat__hash__map_8h.html#a90450f8ab0e3ed9356a35ec8d74b7b5e',1,'flat_hash_map.h']]], - ['ccc_5ffhm_5finit_25',['ccc_fhm_init',['../flat__hash__map_8h.html#af26e0aac66a113372ffd845e7f3b5d5f',1,'flat_hash_map.h']]], + ['ccc_5ffhm_5finit_25',['ccc_fhm_init',['../flat__hash__map_8h.html#abc59d084e446d793cbb386f9486e4bcc',1,'flat_hash_map.h']]], ['ccc_5ffhm_5finsert_5fentry_5fw_26',['ccc_fhm_insert_entry_w',['../flat__hash__map_8h.html#a726c7b51ef2288a25cc9fc8e6d75bd22',1,'flat_hash_map.h']]], ['ccc_5ffhm_5finsert_5for_5fassign_5fr_27',['ccc_fhm_insert_or_assign_r',['../flat__hash__map_8h.html#a70aa536cda96d4572e3d9d4e12fee0e3',1,'flat_hash_map.h']]], ['ccc_5ffhm_5finsert_5for_5fassign_5fw_28',['ccc_fhm_insert_or_assign_w',['../flat__hash__map_8h.html#a2499a64637dc03b73ecf141ac29e7da5',1,'flat_hash_map.h']]],