/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk

« back to all changes in this revision

Viewing changes to src/hash.c

  • Committer: Gustav Hartvigsson
  • Date: 2014-11-24 13:43:46 UTC
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: gustav.hartvigsson@gmail.com-20141124134346-s0rshlu1e0qfo5g5
* Switched licence to a more permisive one.
   No need for it to be LGPL.
* Added hashing functions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
*/
 
3
 
 
4
 
 
5
#inclued "hash.h"
 
6
 
 
7
/*
 
8
 * this is the SDBM hash function from:
 
9
 * http://en.literateprograms.org/Hash_function_comparison_%28C,_sh%29
 
10
 */
 
11
long sdbm_hash (const unsigned char *key) {
 
12
  hash_t h=0;
 
13
  while(*key) h=*key++ + (h<<6) + (h<<16) - h;
 
14
  return h;
 
15
}