Classes | Defines | Typedefs | Functions

hash.c File Reference

#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include "hash.h"
#include "math.h"

Go to the source code of this file.

Classes

struct  ht_bucket
struct  hashtable

Defines

#define INT_PER_DOUBLE   2

Typedefs

typedef struct ht_bucket ht_bucket

Functions

hashtableht_create (int size, ht_keycp cp, ht_keyeq eq, ht_key2hash hash)
void ht_destroy (hashtable *table)
void * ht_insert (hashtable *table, void *key, void *data)
void * ht_find (hashtable *table, void *key)
void * ht_delete (hashtable *table, void *key)
void ht_process (hashtable *table, void(*func)(void *))
static unsigned int strhash (void *key)
static void * strcp (void *key)
static int streq (void *key1, void *key2)
static unsigned int d1hash (void *key)
static void * d1cp (void *key)
int d1eq (void *key1, void *key2)
static unsigned int d2hash (void *key)
static void * d2cp (void *key)
static int d2eq (void *key1, void *key2)
hashtableht_create_d1 (int size)
hashtableht_create_d2 (int size)
hashtableht_create_str (int size)

Define Documentation

#define INT_PER_DOUBLE   2

Definition at line 22 of file hash.c.


Typedef Documentation

typedef struct ht_bucket ht_bucket

Function Documentation

static void* d1cp ( void *  key  )  [static]

Definition at line 344 of file hash.c.

int d1eq ( void *  key1,
void *  key2 
)

Definition at line 353 of file hash.c.

static unsigned int d1hash ( void *  key  )  [static]

Definition at line 333 of file hash.c.

static void* d2cp ( void *  key  )  [static]

Definition at line 379 of file hash.c.

static int d2eq ( void *  key1,
void *  key2 
) [static]

Definition at line 389 of file hash.c.

static unsigned int d2hash ( void *  key  )  [static]

Definition at line 364 of file hash.c.

hashtable* ht_create ( int  size,
ht_keycp  cp,
ht_keyeq  eq,
ht_key2hash  hash 
)

Definition at line 52 of file hash.c.

hashtable* ht_create_d1 ( int  size  ) 

Definition at line 394 of file hash.c.

hashtable* ht_create_d2 ( int  size  ) 

Definition at line 399 of file hash.c.

hashtable* ht_create_str ( int  size  ) 

Definition at line 404 of file hash.c.

void* ht_delete ( hashtable table,
void *  key 
)

Definition at line 231 of file hash.c.

void ht_destroy ( hashtable table  ) 

Definition at line 100 of file hash.c.

void* ht_find ( hashtable table,
void *  key 
)

Definition at line 208 of file hash.c.

void* ht_insert ( hashtable table,
void *  key,
void *  data 
)

Definition at line 133 of file hash.c.

void ht_process ( hashtable table,
void(*)(void *)  func 
)

Definition at line 288 of file hash.c.

static void* strcp ( void *  key  )  [static]

Definition at line 321 of file hash.c.

static int streq ( void *  key1,
void *  key2 
) [static]

Definition at line 326 of file hash.c.

static unsigned int strhash ( void *  key  )  [static]

Definition at line 306 of file hash.c.