29 lines
789 B
C
29 lines
789 B
C
// This file is part of noxos and licensed under the MIT open source license
|
|
|
|
#ifndef NOXOS_HASHMAP_H
|
|
#define NOXOS_HASHMAP_H
|
|
|
|
#include <utils/stdtypes.h>
|
|
|
|
typedef struct hashmap_entry_T hashmap_entry_T;
|
|
struct hashmap_entry_T {
|
|
bool in_use;
|
|
uint64_t key;
|
|
void* value;
|
|
hashmap_entry_T* prev;
|
|
hashmap_entry_T* next;
|
|
};
|
|
|
|
typedef struct {
|
|
uint64_t size;
|
|
hashmap_entry_T* entries;
|
|
} hashmap_T;
|
|
|
|
hashmap_T hashmap_create (uint64_t size);
|
|
void hashmap_destruct (hashmap_T* hashmap);
|
|
void hashmap_insert (hashmap_T* hashmap, uint64_t key, void* value);
|
|
void hashmap_delete (hashmap_T* hashmap, uint64_t key);
|
|
void* hashmap_lookup (hashmap_T* hashmap, uint64_t key);
|
|
|
|
#endif //NOXOS_HASHMAP_H
|