From: Urban Wallasch Date: Thu, 10 Jun 2021 14:22:42 +0000 (+0200) Subject: * Improved file name hashing, slightly. X-Git-Url: https://git.packet-gain.de/?a=commitdiff_plain;h=ae8bdc130661520d8f055bb3c096e19e9cddd8dc;p=imgdupe.git * Improved file name hashing, slightly. --- diff --git a/db.c b/db.c index 371551d..b7b1f8b 100644 --- a/db.c +++ b/db.c @@ -14,8 +14,8 @@ static inline int_fast16_t nhash(const char *s) { int_fast16_t h = 0; while ( *s ) { - h <<= 1; - h |= (h >> NHASH_BITS) & 1; + h <<= 3; + h |= (h >> NHASH_BITS) & 7; h ^= *s++; } return h & NHASH_MASK; diff --git a/db.h b/db.h index 565494f..8f9613b 100644 --- a/db.h +++ b/db.h @@ -4,7 +4,7 @@ #include #include -#define NHASH_BITS 10 +#define NHASH_BITS 12 #define NHASH_SIZE (1 << NHASH_BITS) #define NHASH_MASK (NHASH_SIZE-1)