moved djb2 hash function to its own file

This commit is contained in:
Andre Leiradella 2015-05-24 12:54:48 -03:00
parent 0c10531529
commit 456c674178
2 changed files with 13 additions and 13 deletions

12
src/rl_hash.c Normal file
View 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;
}

View File

@ -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 )
{