mirror of
https://github.com/libretro/retroluxury.git
synced 2024-11-23 07:39:47 +00:00
moved djb2 hash function to its own file
This commit is contained in:
parent
0c10531529
commit
456c674178
12
src/rl_hash.c
Normal file
12
src/rl_hash.c
Normal file
@ -0,0 +1,12 @@
|
||||
static inline uint32_t djb2( const char* str )
|
||||
{
|
||||
const unsigned char* aux = (const unsigned char*)str;
|
||||
uint32_t hash = 5381;
|
||||
|
||||
while ( *aux )
|
||||
{
|
||||
hash = ( hash << 5 ) + hash + *aux++;
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
@ -3,19 +3,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <rl_endian.c>
|
||||
|
||||
static uint32_t djb2( const char* str )
|
||||
{
|
||||
const unsigned char* aux = (const unsigned char*)str;
|
||||
uint32_t hash = 5381;
|
||||
|
||||
while ( *aux )
|
||||
{
|
||||
hash = ( hash << 5 ) + hash + *aux++;
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
#include <rl_hash.c>
|
||||
|
||||
rl_entry_t* rl_find_entry( void* data, const char* name )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user