FACT++  1.0
int HashFunction ( char *  name,
int  max 
)

Definition at line 22 of file hash.c.

References i.

Referenced by dis_hash_service_exists(), dis_hash_service_insert(), dis_hash_service_remove(), service_exists(), and service_insert().

23 {
24  unsigned int b = 378551;
25  unsigned int a = 63689;
26  unsigned int hash = 0;
27  int i = 0;
28  int len;
29 
30  len = (int)strlen(name);
31 
32  for(i = 0; i < len; name++, i++)
33  {
34  hash = hash*a+(unsigned)(*name);
35  a = a*b;
36  }
37 
38  return ((int)(hash % (unsigned)max));
39 }
int i
Definition: db_dim_client.c:21

+ Here is the caller graph for this function: