From ae8bdc130661520d8f055bb3c096e19e9cddd8dc Mon Sep 17 00:00:00 2001 From: Urban Wallasch Date: Thu, 10 Jun 2021 16:22:42 +0200 Subject: [PATCH] * Improved file name hashing, slightly. --- db.c | 4 ++-- db.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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) -- 2.30.2