Lines Matching +full:- +full:p

4  * SPDX-License-Identifier: Apache-2.0
36 * @note The allocator @p _alloc is used for allocating internal Hashmap
37 * entries and does not interact with any user-provided keys or values.
45 * @param ... Variant-specific details for @p _config_type.
64 * @note The allocator @p _alloc is used for allocating internal Hashmap
65 * entries and does not interact with any user-provided keys or values.
73 * @param ... Variant-specific details for @p _config_type.
143 * @param cookie User-specified variable
150 for (map->api->iter(map, &it); sys_hashmap_iterator_has_next(&it);) { in sys_hashmap_foreach()
163 * @param cookie User-specified variable
168 map->api->clear(map, cb, cookie); in sys_hashmap_clear()
174 * Insert a new @p key - @p value pair into @p map.
177 * @param key Key to associate with @p value
178 * @param value Value to associate with @p key
179 * @param old_value Location to store the value previously associated with @p key or `NULL`
180 * @retval 0 if @p value was inserted for an existing key, in which case @p old_value will contain
182 * @retval 1 if a new entry was inserted for the @p key - @p value pair
183 * @retval -ENOMEM if memory allocation failed
184 * @retval -ENOSPC if the size limit has been reached
189 return map->api->insert(map, key, value, old_value); in sys_hashmap_insert()
195 * Erase the entry associated with key @p key, if one exists.
198 * @param key Key to remove from @p map
199 * @param value Location to store a potential value associated with @p key or `NULL`
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.
206 return map->api->remove(map, key, value); in sys_hashmap_remove()
212 * Look-up the @ref uint64_t associated with @p key, if one exists.
215 * @param key Key with which to search @p map
216 * @param value Location to store a potential value associated with @p key or `NULL`
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.
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
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.
241 * @brief Query the number of entries contained within @p map
245 * @return the number of entries contained within @p map.
249 return map->data->size; in sys_hashmap_size()
253 * @brief Check if @p map is empty
257 * @retval true if @p map is empty.
258 * @retval false if @p map is not empty.
262 return map->data->size == 0; in sys_hashmap_is_empty()
266 * @brief Query the load factor of @p map
268 * @note To convert the load factor to a floating-point value use
273 * @return Load factor of @p map expressed in hundredths.
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
288 * @return Number of buckets used in @p map
292 return map->data->n_buckets; in sys_hashmap_num_buckets()
303 * @note Users should call this prior to inserting a new key-value pair and after removing a
304 * key-value pair.
306 * @note The number of reserved entries is implementation-defined, but it is only considered
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()
327 /* All branchless calculations, so very cache-friendly */ in sys_hashmap_should_rehash()
330 size = data->size; in sys_hashmap_should_rehash()
336 n_buckets = data->n_buckets; in sys_hashmap_should_rehash()
338 n_buckets += grow * (size == 1) * config->initial_n_buckets; in sys_hashmap_should_rehash()
348 __ASSERT_NO_MSG(new_num_buckets != &data->n_buckets); in sys_hashmap_should_rehash()
352 grow && (data->n_buckets == 0 || 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()