diff options
Diffstat (limited to 'map.c')
| -rw-r--r-- | map.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -5,6 +5,15 @@ #define DEFAULT_CAPACITY 16 +size_t hash_bytes(const void* start, size_t size) { + size_t hash = 0; + const char* raw_data = start; + for (size_t i = 0; i < size; i++) { + hash = (hash << 5) - hash + raw_data[i]; + } + return hash; +} + void map_init( map_t* map, hash_func_t hash_func, |
