Commit 20c1784a authored by Lenitra's avatar Lenitra
Browse files

hash 1 is empty

parent 469109e2
Loading
Loading
Loading
Loading
−15
Changes for src/hash_tbl.c: 0 added lines, 15 removed lines.
Original line number Diff line number Diff line
@@ -21,24 +21,9 @@ hash_tbl htbl_empty(size_t (*h)(void*),
}

int htbl_add(hash_tbl htbl, void* x){
  size_t key = htbl->h(x);
  size_t index = key % htbl->capacity;
  list_t l = htbl->array[index];
  if (l == NULL){
    l = list_empty();
    htbl->array[index] = l;
  }
  l = list_push(l, x);
  htbl->size++;
}

int htbl_in(hash_tbl htbl, void* x){
  size_t key = htbl->h(x);
  size_t index = key % htbl->capacity;
  list_t l = htbl->array[index];
  if (l == NULL)
    return 0;
  return list_in(l, x, htbl->eq);
}

void htbl_destroy(hash_tbl htbl){