00001 /*************************************************************************** 00002 *cr 00003 *cr (C) Copyright 1995-2008 The Board of Trustees of the 00004 *cr University of Illinois 00005 *cr All Rights Reserved 00006 *cr 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * RCS INFORMATION: 00011 * 00012 * $RCSfile: inthash.h,v $ 00013 * $Author: johns $ $Locker: $ $State: Exp $ 00014 * $Revision: 1.4 $ $Date: 2008/03/27 19:36:51 $ 00015 * 00016 *************************************************************************** 00017 * DESCRIPTION: 00018 * A simple hash table implementation for ints, contributed by John Stone, 00019 * derived from his ray tracer code. 00020 ***************************************************************************/ 00021 #ifndef INTHASH_H 00022 #define INTHASH_H 00023 00025 typedef struct inthash_t { 00026 struct inthash_node_t **bucket; /* array of hash nodes */ 00027 int size; /* size of the array */ 00028 int entries; /* number of entries in table */ 00029 int downshift; /* shift cound, used in hash function */ 00030 int mask; /* used to select bits for hashing */ 00031 } inthash_t; 00032 00033 #define HASH_FAIL -1 00034 00035 #if defined(VMDPLUGIN_STATIC) 00036 #define VMDEXTERNSTATIC static 00037 #include "inthash.c" 00038 #else 00039 00040 #define VMDEXTERNSTATIC 00041 00042 #ifdef __cplusplus 00043 extern "C" { 00044 #endif 00045 00047 void inthash_init(inthash_t *, int); 00048 00050 int inthash_lookup (const inthash_t *, int); 00051 00053 int inthash_insert (inthash_t *, int, int); 00054 00056 int inthash_delete (inthash_t *, int); 00057 00059 void inthash_destroy(inthash_t *); 00060 00062 char *inthash_stats (inthash_t *); 00063 00064 #ifdef __cplusplus 00065 } 00066 #endif 00067 00068 #endif 00069 00070 #endif
1.2.14 written by Dimitri van Heesch,
© 1997-2002