The hash function is identical to the 32-bit signed int hash function. This
function is unideal for such extended use, but is sufficient for now
return *key1 == *key2;
}
+size_t
+dict_hash_uint64(const uint64_t *key)
+{
+ // I use the same hash function as for 32-bit signed integers. This
+ // probably will not have great performance for values that don't fit
+ // into a 32-bit signed int, but this will do for now
+ int key32 = (int)(*key);
+ return dict_hash_int(&key32);
+}
+
+int
+dict_eq_uint64(const uint64_t *key1, const uint64_t *key2)
+{
+ return *key1 == *key2;
+}
+
size_t
dict_hash_string(const char **key)
{
#define _DICT_H_
#include <stddef.h>
+#include <stdint.h>
#include <assert.h>
#include "vect.h"
/* An equality predicate callback for integers. */
int dict_eq_int(const int *key1, const int *key2);
+/* A callback for hashing uint64_t. */
+size_t dict_hash_uint64(const uint64_t *key);
+
+/* An equality predicate callback for uint64_t. */
+int dict_eq_uint64(const uint64_t *key1, const uint64_t *key2);
+
/* A callback for hashing NULL-terminated strings. */
size_t dict_hash_string(const char **key);