toys/simple-http-server-c/source/hash_map.h

21 lines
462 B
C

#pragma once
#include <assert.h>
#include <stdint.h>
// Open Addressing Hash Table
typedef struct HashMap HashMap;
typedef enum
{
kPowerOfTwo = 0,
kPrime = 1,
} HashMapGrowthPolicy;
HashMap *HashMap_Create(uint32_t num);
HashMap *HashMap_CreateWithPolicy(uint32_t num, HashMapGrowthPolicy policy);
uint32_t HashMap_Size(HashMap *o);
uint32_t HashMap_Capacity(HashMap *o);
int HashMap_Empty(HashMap *o);
int HashMap_Reserve(HashMap *o, uint32_t num);