bzr branch
http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk
|
5.2.7
by Gustav Hartvigsson
* Switched licence to a more permisive one. |
1 |
/*
|
2 |
*/
|
|
3 |
||
4 |
||
|
30
by Gustav Hartvigsson
* Made the code compile using CMake. |
5 |
#include "hash.h" |
|
5.2.7
by Gustav Hartvigsson
* Switched licence to a more permisive one. |
6 |
|
7 |
/*
|
|
8 |
* this is the SDBM hash function from:
|
|
9 |
* http://en.literateprograms.org/Hash_function_comparison_%28C,_sh%29
|
|
10 |
*/
|
|
|
46
by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray. |
11 |
hash_t sdbm_hash (const unsigned char *key) { |
|
5.2.7
by Gustav Hartvigsson
* Switched licence to a more permisive one. |
12 |
hash_t h=0; |
13 |
while(*key) h=*key++ + (h<<6) + (h<<16) - h; |
|
14 |
return h; |
|
15 |
}
|