From 2625019add3d16d3ee5d210bcebdd999d3b0cc32 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Thu, 21 Oct 2021 18:23:18 +0200 Subject: Change environments to be a hash table --- src/bootstrap/hashtable.h | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'src/bootstrap/hashtable.h') 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) { uint64_t hash = 0x65d9d65f6a19574f; char *last = (char *)key + n; while (key != last) { - putchar(*key); hash ^= (uint64_t)*key++; hash = (hash << 8) | (hash >> (64 - 8)); } @@ -50,7 +49,7 @@ _fibonacci_hash(uint64_t hash, size_t shift_amount) { uint64_t ht_hash(const HashTable *table, const Object *key) { - uint64_t hash; + uint64_t hash = 0; switch (key->type) { case OBJ_TYPE_FIXNUM: { hash = key->fixnum; @@ -177,23 +176,6 @@ ht_lookup(const HashTable *table, const Object *key) { return pairs[probe_position].value; } -void -ht_debug(HashTable *table) { - HashTablePair *pairs = table->pairs; - for (size_t i = 0; i < array_cap(pairs); i++) { - printf("i: %ld ", i); - if (pairs[i].key == NULL) { - printf("EMPTY\n"); - } else { - printf("key: "); - display(pairs[i].key); - printf(" value: "); - display(pairs[i].value); - printf("\n"); - } - } -} - void ht_free(HashTable *table) { if (table == NULL) { -- cgit v1.2.1