hash function for reference;
This commit is contained in:
parent
573e0a9eaa
commit
3c9528bb0a
14
src/main.c
14
src/main.c
@ -20,7 +20,21 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <eport.h>
|
||||
|
||||
unsigned long djb_hash(const char *s)
|
||||
{
|
||||
unsigned long hash = 5381;
|
||||
int c;
|
||||
|
||||
while((c = *s++))
|
||||
hash = ((hash << 5) + hash) + c;
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user