summaryrefslogtreecommitdiff
path: root/insert_string.c
diff options
context:
space:
mode:
authorHans Kristian Rosbach <hk-git@circlestorm.org>2020-08-21 16:17:55 +0200
committerHans Kristian Rosbach <hk-github@circlestorm.org>2020-08-23 09:57:45 +0200
commitcbc3962b937315ccfb0108a6a96ee005328f467c (patch)
treebdd963f2a79d509a0f80ffa42e29807857de0de5 /insert_string.c
parente7bb6db09a183807a8f94a8bdcf156a765402d9f (diff)
Increase hash table size from 15 to 16 bits.
This gives a good performance increase, and usually also improves compression. Make separate define HASH_SLIDE for fallback version of UPDATE_HASH.
Diffstat (limited to 'insert_string.c')
-rw-r--r--insert_string.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/insert_string.c b/insert_string.c
index 7233668..4ddf9ae 100644
--- a/insert_string.c
+++ b/insert_string.c
@@ -14,8 +14,10 @@
* input characters, so that a running hash key can be computed from the
* previous key instead of complete recalculation each time.
*/
+#define HASH_SLIDE 16 // Number of bits to slide hash
+
#define UPDATE_HASH(s, h, val) \
- h = ((val * 2654435761U) >> (32 - HASH_BITS));
+ h = ((val * 2654435761U) >> HASH_SLIDE);
#define INSERT_STRING insert_string_c
#define QUICK_INSERT_STRING quick_insert_string_c