Minor hash improvement
This commit is contained in:
+2
-3
@@ -48,13 +48,12 @@ u_int32_t ndpi_quick_hash(const unsigned char *str, u_int str_len) {
|
|||||||
|
|
||||||
/* ******************************************************************** */
|
/* ******************************************************************** */
|
||||||
|
|
||||||
/* Based on Daniel Lemire code */
|
|
||||||
u_int64_t ndpi_quick_hash64(const char *str, u_int str_len) {
|
u_int64_t ndpi_quick_hash64(const char *str, u_int str_len) {
|
||||||
u_int64_t h = 0;
|
u_int64_t h = 177;
|
||||||
u_int i;
|
u_int i;
|
||||||
|
|
||||||
for(i=0; i<str_len; i++)
|
for(i=0; i<str_len; i++)
|
||||||
h = (h * 177) + str[i];
|
h = (h * 31) + str[i];
|
||||||
|
|
||||||
h ^= str_len;
|
h ^= str_len;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user