diff options
Diffstat (limited to 'src/base')
| -rw-r--r-- | src/base/system.c | 10 | ||||
| -rw-r--r-- | src/base/system.h | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/base/system.c b/src/base/system.c index be2a5d5a..f570fdf3 100644 --- a/src/base/system.c +++ b/src/base/system.c @@ -1354,6 +1354,16 @@ int str_utf8_decode(const char **ptr) } + +unsigned str_quickhash(const char *str) +{ + unsigned hash = 5381; + for(; *str; str++) + hash = ((hash << 5) + hash) + (*str); /* hash * 33 + c */ + return hash; +} + + #if defined(__cplusplus) } #endif diff --git a/src/base/system.h b/src/base/system.h index 7a734cfd..cdbfe294 100644 --- a/src/base/system.h +++ b/src/base/system.h @@ -971,7 +971,7 @@ void net_stats(NETSTATS *stats); int str_isspace(char c); char str_uppercase(char c); - +unsigned str_quickhash(const char *str); /* Function: gui_messagebox |