summaryrefslogtreecommitdiff
path: root/src/map.h
blob: 6678dddc68d38239a467dbc40698071e044db32f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#pragma once

#include "common.h"
#include "smrt_arena.h"

// Hashmap structure that stores u8* keys and void* values.
// API: map_create, map_insert, map_delete, map_lookup
// There is no map_destroy. It is allocated on the arena
// Uses a5hash to hash keys.
typedef struct _map_t* map_t;

map_t  map_create(smrt_arena_t *arena, u64 table_size);
  i32  map_insert(map_t const map, u8 const *key, u64 keylen, void *value);
  i32  map_delete(map_t const map, u8 const *key, u64 keylen);
 void *map_lookup(map_t const map, u8 const *key, u64 keylen);