aboutsummaryrefslogtreecommitdiffstats
path: root/src/bootstrap/hashtable.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/bootstrap/hashtable.h')
-rw-r--r--src/bootstrap/hashtable.h20
1 files changed, 1 insertions, 19 deletions
diff --git a/src/bootstrap/hashtable.h b/src/bootstrap/hashtable.h
index ca4ced8..ea24d04 100644
--- a/src/bootstrap/hashtable.h
+++ b/src/bootstrap/hashtable.h
@@ -35,7 +35,6 @@ _xor_shift_hash(const char *key, size_t n) {
35 uint64_t hash = 0x65d9d65f6a19574f; 35 uint64_t hash = 0x65d9d65f6a19574f;
36 char *last = (char *)key + n; 36 char *last = (char *)key + n;
37 while (key != last) { 37 while (key != last) {
38 putchar(*key);
39 hash ^= (uint64_t)*key++; 38 hash ^= (uint64_t)*key++;
40 hash = (hash << 8) | (hash >> (64 - 8)); 39 hash = (hash << 8) | (hash >> (64 - 8));
41 } 40 }
@@ -50,7 +49,7 @@ _fibonacci_hash(uint64_t hash, size_t shift_amount) {
50 49
51uint64_t 50uint64_t
52ht_hash(const HashTable *table, const Object *key) { 51ht_hash(const HashTable *table, const Object *key) {
53 uint64_t hash; 52 uint64_t hash = 0;
54 switch (key->type) { 53 switch (key->type) {
55 case OBJ_TYPE_FIXNUM: { 54 case OBJ_TYPE_FIXNUM: {
56 hash = key->fixnum; 55 hash = key->fixnum;
@@ -178,23 +177,6 @@ ht_lookup(const HashTable *table, const Object *key) {
178} 177}
179 178
180void 179void
181ht_debug(HashTable *table) {
182 HashTablePair *pairs = table->pairs;
183 for (size_t i = 0; i < array_cap(pairs); i++) {
184 printf("i: %ld ", i);
185 if (pairs[i].key == NULL) {
186 printf("EMPTY\n");
187 } else {
188 printf("key: ");
189 display(pairs[i].key);
190 printf(" value: ");
191 display(pairs[i].value);
192 printf("\n");
193 }
194 }
195}
196
197void
198ht_free(HashTable *table) { 180ht_free(HashTable *table) {
199 if (table == NULL) { 181 if (table == NULL) {
200 return; 182 return;