chore: documentation and readability of hash_map.c
This commit is contained in:
		
							parent
							
								
									2021092a17
								
							
						
					
					
						commit
						e99e391ffa
					
				|  | @ -33,9 +33,9 @@ void *hash_map_get_raw(HashMap *self, void *key) { | |||
| void hash_map_insert(HashMap *self, void *key, void *value) { | ||||
|     uintptr_t hash = self->hasher(key); | ||||
|     // stage key-value-pair data
 | ||||
|     char data[sizeof(uintptr_t) + self->key_size + self->value_size]; | ||||
|     char data[self->buckets[0].element_size]; | ||||
|     memcpy(data, &hash, sizeof(uintptr_t)); // copy key hash into start of data
 | ||||
|     memcpy(data + sizeof(uintptr_t), key, self->key_size); | ||||
|     memcpy(data + sizeof(uintptr_t), key, self->key_size); // copy key after hash
 | ||||
|     memcpy(data + sizeof(uintptr_t) + self->key_size, value, self->value_size); // copy value into end of data
 | ||||
|     // insert staged data into list
 | ||||
|     list_add(self->buckets + (hash % CUTES_HASH_MAP_BUCKETS), data); | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Sara
						Sara