|
PatchworkOS
|
#include <kernel/utils/map.h>#include <errno.h>#include <stdlib.h>#include <string.h>#include <sys/math.h>Go to the source code of this file.
Functions | |
| static bool | is_power_of_two (uint64_t n) |
| static uint64_t | next_power_of_two (uint64_t n) |
| uint64_t | hash_object (const void *object, uint64_t length) |
| Hash a object. | |
| bool | map_key_is_equal (const map_key_t *a, const map_key_t *b) |
| void | map_entry_init (map_entry_t *entry) |
| Initialize a map entry. | |
| static uint64_t | map_find_slot (const map_t *map, const map_key_t *key, bool forInsertion) |
| static uint64_t | map_resize (map_t *map, uint64_t newCapacity) |
| uint64_t | map_init (map_t *map) |
| Initialize a map. | |
| void | map_deinit (map_t *map) |
| Deinitialize a map. | |
| uint64_t | map_insert (map_t *map, const map_key_t *key, map_entry_t *entry) |
| Insert a key-value pair into the map. | |
| map_entry_t * | map_get (map_t *map, const map_key_t *key) |
| Get a value from the map by key. | |
| void | map_remove (map_t *map, const map_key_t *key) |
| Remove a key-value pair from the map. | |
| uint64_t | map_size (const map_t *map) |
| Get the number of entries in the map. | |
| uint64_t | map_capacity (const map_t *map) |
| Get the capacity of the map. | |
| bool | map_is_empty (const map_t *map) |
| Check if the map is empty. | |
| bool | map_contains (map_t *map, const map_key_t *key) |
| Check if the map contains a key. | |
| void | map_clear (map_t *map) |
| Clear all entries from the map. | |
| uint64_t | map_reserve (map_t *map, uint64_t minCapacity) |
Reserve space in the map for at least minCapacity entries. | |
Definition at line 8 of file map.c.
Referenced by map_resize().
|
static |
Definition at line 78 of file map.c.
References ERR, map_key_t::hash, map_entry_t::key, map, map_key_is_equal(), MAP_TOMBSTONE, and NULL.
Referenced by map_get(), map_insert(), map_remove(), and map_resize().
Definition at line 56 of file map.c.
References map_key_t::hash, map_key_t::key, map_key_t::len, and memcmp().
Referenced by map_find_slot(), map_get(), map_insert(), and map_remove().
Definition at line 120 of file map.c.
References calloc(), ERR, free(), is_power_of_two(), map_entry_t::key, boot_memory_map_t::length, map, map_find_slot(), MAP_TOMBSTONE, next_power_of_two(), and NULL.
Referenced by map_insert(), and map_reserve().
Definition at line 13 of file map.c.
References UINT64_MAX.
Referenced by map_reserve(), and map_resize().