f10-binary-tree #27

Merged
Mineplay merged 16 commits from f10-binary-tree into main 2025-09-03 13:20:51 -05:00
Showing only changes of commit ecbffdc112 - Show all commits

View file

@ -119,12 +119,21 @@ FledastyError fledasty_hash_table_##name##_insert(FledastyHashTable_##name *curr
hallocy_free(previous_table); \
} \
\
const size_t index = current_hash_table->hash_function(key) % current_hash_table->capacity; \
\
FledastyHashTablePair_##name pair = { .key = key, .value = value }; \
fledasty_dynamic_array_fledasty_internal_pair_append(&current_hash_table->Table[index], pair); \
const size_t index = current_hash_table->hash_function(key) % current_hash_table->capacity; \
if (fledasty_dynamic_array_fledasty_internal_pair_has_value(&current_hash_table->Table[index], pair)) { \
size_t key_index = 0; \
while (!compare_key_function(current_hash_table->Table[index].buffer[key_index].key, key)) { \
key_index += 1; \
} \
\
current_hash_table->Table[index].buffer[key_index].value = value; \
return FLEDASTY_ERROR_VALUE_REPLACED; \
} \
\
fledasty_dynamic_array_fledasty_internal_pair_append(&current_hash_table->Table[index], pair); \
current_hash_table->size += 1; \
\
return FLEDASTY_ERROR_NONE; \
} \
\