jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 1 | /* |
| 2 | ------------------------------------------------------------------------------ |
| 3 | By Bob Jenkins, September 1996. |
| 4 | lookupa.h, a hash function for table lookup, same function as lookup.c. |
| 5 | Use this code in any way you wish. Public Domain. It has no warranty. |
| 6 | Source is http://burtleburtle.net/bob/c/lookupa.h |
| 7 | ------------------------------------------------------------------------------ |
| 8 | */ |
| 9 | |
| 10 | /* Uncommented by Jens Jakobsen 20020717 |
| 11 | #ifndef STANDARD |
| 12 | #include "standard.h" |
| 13 | #endif |
| 14 | */ |
| 15 | |
| 16 | #ifndef LOOKUPA |
| 17 | #define LOOKUPA |
| 18 | |
| 19 | typedef unsigned long int ub4; /* unsigned 4-byte quantities */ |
| 20 | typedef unsigned char ub1; |
| 21 | |
| 22 | #define CHECKSTATE 8 |
| 23 | #define hashsize(n) ((ub4)1<<(n)) |
| 24 | #define hashmask(n) (hashsize(n)-1) |
| 25 | |
| 26 | ub4 lookup(/*_ ub1 *k, ub4 length, ub4 level _*/); |
| 27 | void checksum(/*_ ub1 *k, ub4 length, ub4 *state _*/); |
| 28 | |
| 29 | #endif /* LOOKUPA */ |