diff options
author | pixel <pixel> | 2008-01-28 12:49:06 +0000 |
---|---|---|
committer | pixel <pixel> | 2008-01-28 12:49:06 +0000 |
commit | 7ecf94d4b339bc2197f449f0f1538f2915313087 (patch) | |
tree | 02167bb1970b7adb53bf7aaa5bb5aaf726d11932 /lookupa.h | |
parent | a578df37ca8c4c130f28ccfd12948bc2fe429526 (diff) |
Trying with a hashtable instead of a dumb structure.
Diffstat (limited to 'lookupa.h')
-rw-r--r-- | lookupa.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lookupa.h b/lookupa.h new file mode 100644 index 0000000..8001b3c --- /dev/null +++ b/lookupa.h @@ -0,0 +1,30 @@ +/* +------------------------------------------------------------------------------ +By Bob Jenkins, September 1996. +lookupa.h, a hash function for table lookup, same function as lookup.c. +Use this code in any way you wish. Public Domain. It has no warranty. +Source is http://burtleburtle.net/bob/c/lookupa.h +------------------------------------------------------------------------------ +*/ + +#ifndef LOOKUPA +#define LOOKUPA + +#include <stdint.h> + +#define CHECKSTATE 8 +#define hashsize(n) ((uint32_t)1<<(n)) +#define hashmask(n) (hashsize(n)-1) + +#ifdef __cplusplus +extern "C" { +#endif + +uint32_t lookup(uint8_t * k, uint32_t length, uint32_t level); +void checksum(uint8_t * k, uint32_t length, uint32_t * state); + +#ifdef __cplusplus +} +#endif + +#endif /* LOOKUPA */ |