before next stage

This commit is contained in:
eason
2023-12-20 18:54:24 +08:00
commit c6f08be676
38 changed files with 183324 additions and 0 deletions

22
include/hashmap.h Normal file
View File

@ -0,0 +1,22 @@
#include <stdbool.h>
#include "rust.h"
#define B 100
struct Entries{
void* key;
void* val;
};
struct Entry{
usize size;
usize cap;
struct Entries* list;
};
struct HashMap{
struct Entry entry[B];
usize (*hasher)(void *);
bool (*eq)(void *,void *);
};
void hash_new(struct HashMap* map,usize (*hasher)(void *), bool (*eq)(void *,void *));
void hash_insert(struct HashMap* map,void* key,void* val);
void* hash_get(struct HashMap* map,void* key);
void* hash_pop(struct HashMap* map,void* key);