Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

inthash.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "inthash.h"

Go to the source code of this file.

Compounds

struct  inthash_node_t

Defines

#define HASH_LIMIT   0.5

Typedefs

typedef inthash_node_t inthash_node_t

Functions

int inthash (const inthash_t *tptr, int key)
VMDEXTERNSTATIC void inthash_init (inthash_t *tptr, int buckets)
void rebuild_table_int (inthash_t *tptr)
VMDEXTERNSTATIC int inthash_lookup (const inthash_t *tptr, int key)
VMDEXTERNSTATIC int inthash_insert (inthash_t *tptr, int key, int data)
VMDEXTERNSTATIC int inthash_delete (inthash_t *tptr, int key)
VMDEXTERNSTATIC int inthash_entries (inthash_t *tptr)
VMDEXTERNSTATIC void inthash_destroy (inthash_t *tptr)
float alos_int (inthash_t *tptr)
VMDEXTERNSTATIC char * inthash_stats (inthash_t *tptr)


Define Documentation

#define HASH_LIMIT   0.5
 

Definition at line 30 of file inthash.c.

Referenced by inthash_insert.


Typedef Documentation

typedef struct inthash_node_t inthash_node_t
 

hash table node data structure


Function Documentation

float alos_int inthash_t   tptr [static]
 

Definition at line 256 of file inthash.c.

References alos_int, inthash_t::bucket, inthash_t::entries, inthash_node_t::next, NULL, and inthash_t::size.

Referenced by alos_int, and inthash_stats.

int inthash const inthash_t   tptr,
int    key
[static]
 

Definition at line 45 of file inthash.c.

References inthash_t::downshift, and inthash_t::mask.

Referenced by inthash_delete, inthash_insert, inthash_lookup, and rebuild_table_int.

VMDEXTERNSTATIC int inthash_delete inthash_t  ,
int   
 

delete an int from the hash table, given its key

Definition at line 182 of file inthash.c.

References inthash_t::bucket, inthash_node_t::data, data, inthash, inthash_node_t::key, inthash_node_t::next, and NULL.

VMDEXTERNSTATIC void inthash_destroy inthash_t  
 

destroy the hash table completely, deallocate memory

Definition at line 231 of file inthash.c.

References inthash_t::bucket, inthash_node_t::next, NULL, and inthash_t::size.

VMDEXTERNSTATIC int inthash_entries inthash_t  
 

return the number of entries in the hash table

Definition at line 222 of file inthash.c.

References inthash_t::entries.

VMDEXTERNSTATIC void inthash_init inthash_t  ,
int   
 

initialize hash table for first use

Definition at line 62 of file inthash.c.

References inthash_t::bucket, inthash_t::downshift, inthash_t::entries, inthash_t::mask, and inthash_t::size.

VMDEXTERNSTATIC int inthash_insert inthash_t  ,
int   ,
int   
 

insert an int into the hash table, along with an integer key

Definition at line 150 of file inthash.c.

References inthash_t::bucket, inthash_node_t::data, data, inthash_t::entries, HASH_LIMIT, inthash, inthash_lookup, inthash_node_t::key, inthash_node_t::next, rebuild_table_int, and inthash_t::size.

VMDEXTERNSTATIC int inthash_lookup const inthash_t  ,
int   
 

lookup a key in the hash table returning its integer key

Definition at line 126 of file inthash.c.

References inthash_t::bucket, inthash_node_t::data, inthash, inthash_node_t::key, inthash_node_t::next, and NULL.

VMDEXTERNSTATIC char* inthash_stats inthash_t  
 

print hash table vital stats

Definition at line 277 of file inthash.c.

References alos_int, inthash_t::entries, and inthash_t::size.

void rebuild_table_int inthash_t   tptr [static]
 

Definition at line 92 of file inthash.c.

References inthash_t::bucket, inthash_t::entries, inthash, inthash_init, inthash_node_t::key, inthash_node_t::next, and inthash_t::size.

Referenced by inthash_insert.


Generated on Mon Dec 9 02:45:23 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002