Paul Pan
a471519ff7
1. add basic dl_call support 2. re-organize code structure 3. fix `wasm_runtime_call_wasm` error handler 4. update examples
33 lines
555 B
C
33 lines
555 B
C
#ifndef WRT_TINYMAP_H
|
|
#define WRT_TINYMAP_H
|
|
|
|
#include <stdbool.h>
|
|
|
|
#ifndef BUK_SIZE
|
|
#define BUK_SIZE 8
|
|
#endif
|
|
|
|
#ifndef NOD_SIZE
|
|
#define NOD_SIZE 32
|
|
#endif
|
|
|
|
typedef struct {
|
|
int key;
|
|
void *value;
|
|
unsigned next;
|
|
} MapNode;
|
|
|
|
typedef struct {
|
|
MapNode node[NOD_SIZE + 1];
|
|
unsigned head[BUK_SIZE];
|
|
unsigned count;
|
|
} Map;
|
|
|
|
void map_init(Map *map);
|
|
void *map_get(Map *map, int key);
|
|
bool map_set(Map *map, int key, void *value);
|
|
void map_delete(Map *map, int key);
|
|
void map_compact(Map *map);
|
|
|
|
#endif // WRT_TINYMAP_H
|