update vibration handling
[pcsx_rearmed.git] / deps / libretro-common / utils / djb2.c
CommitLineData
3719602c
PC
1/* public domain */
2/* gcc -O3 -o djb2 djb2.c */
3
4#include <stdio.h>
5#include <stdint.h>
6
7static 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
18int 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}