Skip to content

Instantly share code, notes, and snippets.

@mc1100
mc1100 / hashtable.c
Created June 13, 2015 10:38
Simple hashtable in C
#include "hash.h"
#include <stdlib.h>
static unsigned index(Hashtable *hashtable, void *key) {
unsigned i = (unsigned) key % hashtable->size;
while (hashtable->keys[i] && hashtable->keys[i] != key) {
if (++i >= hashtable->size) {
i = 0;
}

Keybase proof

I hereby claim:

  • I am mc1100 on github.
  • I am mc1100 (https://keybase.io/mc1100) on keybase.
  • I have a public key ASBGWpQE3yUmW-8szyqQq2PzIf0V4EjquRqCGdiYN22GnAo

To claim this, I am signing this object: