source: branches/v2.9/common_functions/hash_funcs.c

Last change on this file was 2, checked in by stevenhl, 8 years ago

Import sources from cwmm-full.zip dated 2005-03-21

File size: 590 bytes
Line 
1#include <os2.h>
2
3#define HASHSIZE 101
4ULONG calculateHash(char * theString)
5{
6 ULONG ulHash=0;
7
8 if(theString)
9 for(ulHash=0;*theString!='\0'; theString++)
10 ulHash=*theString+31*ulHash;
11
12 return ulHash%HASHSIZE;
13}
14//#define HASHSIZE2 123
15ULONG calculateHash2(char * theString)
16{
17 ULONG ulHash=0;
18
19 if(theString)
20 for(ulHash=0;*theString!='\0'; theString++)
21 ulHash=*theString+37*ulHash;
22
23 return ulHash%HASHSIZE;
24}
25
26USHORT calculateTheHash(char *chrCommand)
27{
28 return ((calculateHash(chrCommand)<<8) + calculateHash2(chrCommand));
29}
Note: See TracBrowser for help on using the repository browser.