some use of sdbm hash

This commit is contained in:
2019-03-01 09:27:03 +00:00
parent 6463fbec12
commit 1aea9f4492
4 changed files with 34 additions and 20 deletions

View File

@ -1698,9 +1698,16 @@ int qse_awk_rtx_strtonum (
static qse_awk_uint_t hash (qse_uint8_t* ptr, qse_size_t len)
{
/*
qse_awk_uint_t h = 5381;
while (len > 0) h = ((h << 5) + h) + ptr[--len];
return h;
*/
/* SDBM hash */
qse_awk_uint_t h = 0;
while (len > 0) h = (h << 6) + (h << 16) - h + ptr[--len];
return h;
}
qse_awk_int_t qse_awk_rtx_hashval (qse_awk_rtx_t* rtx, qse_awk_val_t* v)