Lines Matching full:map

141  * @param map Hashmap to iterate over
145 static inline void sys_hashmap_foreach(const struct sys_hashmap *map, sys_hashmap_callback_t cb, in sys_hashmap_foreach() argument
150 for (map->api->iter(map, &it); sys_hashmap_iterator_has_next(&it);) { in sys_hashmap_foreach()
161 * @param map Hashmap to clear
165 static inline void sys_hashmap_clear(struct sys_hashmap *map, sys_hashmap_callback_t cb, in sys_hashmap_clear() argument
168 map->api->clear(map, cb, cookie); in sys_hashmap_clear()
174 * Insert a new @p key - @p value pair into @p map.
176 * @param map Hashmap to insert into
186 static inline int sys_hashmap_insert(struct sys_hashmap *map, uint64_t key, uint64_t value, in sys_hashmap_insert() argument
189 return map->api->insert(map, key, value, old_value); in sys_hashmap_insert()
197 * @param map Hashmap to remove from
198 * @param key Key to remove from @p map
201 * @retval true if @p map was modified as a result of this operation.
202 * @retval false if @p map does not contain a value associated with @p key.
204 static inline bool sys_hashmap_remove(struct sys_hashmap *map, uint64_t key, uint64_t *value) in sys_hashmap_remove() argument
206 return map->api->remove(map, key, value); in sys_hashmap_remove()
214 * @param map Hashmap to search through
215 * @param key Key with which to search @p map
218 * @retval true if @p map contains a value associated with @p key.
219 * @retval false if @p map does not contain a value associated with @p key.
221 static inline bool sys_hashmap_get(const struct sys_hashmap *map, uint64_t key, uint64_t *value) in sys_hashmap_get() argument
223 return map->api->get(map, key, value); in sys_hashmap_get()
227 * @brief Check if @p map contains a value associated with @p key
229 * @param map Hashmap to search through
230 * @param key Key with which to search @p map
232 * @retval true if @p map contains a value associated with @p key.
233 * @retval false if @p map does not contain a value associated with @p key.
235 static inline bool sys_hashmap_contains_key(const struct sys_hashmap *map, uint64_t key) in sys_hashmap_contains_key() argument
237 return sys_hashmap_get(map, key, NULL); in sys_hashmap_contains_key()
241 * @brief Query the number of entries contained within @p map
243 * @param map Hashmap to search through
245 * @return the number of entries contained within @p map.
247 static inline size_t sys_hashmap_size(const struct sys_hashmap *map) in sys_hashmap_size() argument
249 return map->data->size; in sys_hashmap_size()
253 * @brief Check if @p map is empty
255 * @param map Hashmap to query
257 * @retval true if @p map is empty.
258 * @retval false if @p map is not empty.
260 static inline bool sys_hashmap_is_empty(const struct sys_hashmap *map) in sys_hashmap_is_empty() argument
262 return map->data->size == 0; in sys_hashmap_is_empty()
266 * @brief Query the load factor of @p map
269 * `sys_hash_load_factor(map) / 100.0f`.
271 * @param map Hashmap to query
273 * @return Load factor of @p map expressed in hundredths.
275 static inline uint8_t sys_hashmap_load_factor(const struct sys_hashmap *map) in sys_hashmap_load_factor() argument
277 if (map->data->n_buckets == 0) { in sys_hashmap_load_factor()
281 return (map->data->size * 100) / map->data->n_buckets; in sys_hashmap_load_factor()
285 * @brief Query the number of buckets used in @p map
287 * @param map Hashmap to query
288 * @return Number of buckets used in @p map
290 static inline size_t sys_hashmap_num_buckets(const struct sys_hashmap *map) in sys_hashmap_num_buckets() argument
292 return map->data->n_buckets; in sys_hashmap_num_buckets()
309 * @param map Hashmap to examine
316 static inline bool sys_hashmap_should_rehash(const struct sys_hashmap *map, bool grow, in sys_hashmap_should_rehash() argument
324 struct sys_hashmap_oa_lp_data *const data = (struct sys_hashmap_oa_lp_data *)map->data; in sys_hashmap_should_rehash()
325 const struct sys_hashmap_config *const config = map->config; in sys_hashmap_should_rehash()
353 (size + num_reserved) * 100 / data->n_buckets > map->config->load_factor); in sys_hashmap_should_rehash()
355 shrink && (n_buckets == 0 || (size * 100) / n_buckets <= map->config->load_factor); in sys_hashmap_should_rehash()