hashmap_put function

This commit is contained in:
2020-08-07 11:26:52 +02:00
parent e1b317d9a7
commit 064885298f
5 changed files with 60 additions and 46 deletions

View File

@ -1,15 +1,17 @@
#ifndef _acl_hashmap_h
#define _acl_hashmap_h
#include <stddef.h>
#include <stdbool.h>
#define acl_hashmap_create(type, keyType, bucketCount) acl_hashmap_init(bucketCount, sizeof(struct{type c; type d;}), offsetof(struct{type c; type d;}, d), sizeof(keyType));
union acl_hashmap_meta {
void *dummy_ptr;
struct {
size_t bucketCount;
size_t bucketBits;
size_t sizeOneElement;
size_t keyBits;
size_t keySize;
size_t offset;
};
};
/* set keySize to NULL for a dynamic keySize */
union acl_hashmap_meta* acl_hashmap_create(size_t bucketCount, size_t sizeOneElement, size_t keySize);
void acl_hashmap_put(union acl_hashmap_meta *hashmap_meta, void *key, void *element);
union acl_hashmap_meta* acl_hashmap_init(size_t bucketCount, size_t sizeOneElement, size_t offset, size_t keySize);
void* acl_hashmap_put(union acl_hashmap_meta *hashmap_meta, void *key);
#endif