HashMapKeyValue.value -> value_ptr

This commit is contained in:
2025-12-02 20:06:02 +05:00
parent 17d2d1c38d
commit 0d422cd7e5
3 changed files with 6 additions and 6 deletions

View File

@@ -3,9 +3,9 @@
/// USAGE insertionSort(list.data, list.len, .id)
#define insertionSort_inline(arr, n, field) \
for(i32 i = 1, j; i < n; i++) { \
for(i32 i = 1, j; i < (i32)n; i++) { \
j = i; \
while( j > 0 && arr[j - 1]##field > arr[i]##field){\
while( j > 0 && arr[j - 1]field > arr[i]field){\
arr[j] = arr[j - 1]; \
j--; \
} \
@@ -17,12 +17,12 @@
i32 high = n - 1; \
while (low <= high) { \
i32 mid = low + (high - low) / 2; \
if (arr[mid]##field == key) { \
if (arr[mid]field == key) { \
out_index = mid; \
break; \
} \
/* choose left or right half */ \
if (arr[mid]##field < key) \
if (arr[mid]field < key) \
low = mid + 1; \
else high = mid - 1; \
} \

View File

@@ -43,7 +43,7 @@ typedef struct HashMapIter {
typedef struct HashMapKeyValue {
str key;
void* value;
void* value_ptr;
} HashMapKeyValue;
static inline HashMapIter HashMapIter_create(const HashMap_* table){

View File

@@ -225,6 +225,6 @@ bool HashMapIter_getCurrent(HashMapIter* self, HashMapKeyValue* kv){
return false;
kv->key = bu->key_hash_list.data[self->elem_n].key;
kv->value = (u8*)bu->value_list.data + self->map->value_t_size * self->elem_n;
kv->value_ptr = (u8*)bu->value_list.data + self->map->value_t_size * self->elem_n;
return true;
}