more makefile updates
[pcsx_rearmed.git] / deps / libretro-common / utils / djb2.c
1 /* public domain */
2 /* gcc -O3 -o djb2 djb2.c */
3
4 #include <stdio.h>
5 #include <stdint.h>
6
7 static uint32_t djb2(const char* str)
8 {
9    const unsigned char* aux = (const unsigned char*)str;
10    uint32_t hash = 5381;
11
12    while (*aux)
13       hash = (hash << 5) + hash + *aux++;
14
15    return hash;
16 }
17
18 int main(int argc, const char* argv[])
19 {
20    int i;
21
22    for (i = 1; i < argc; i++)
23       printf( "0x%08xU: %s\n", djb2( argv[ i ] ), argv[ i ] );
24
25    return 0;
26 }