1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-10 03:33:12 +02:00

core: use fixed-width integer for computing hashtable DJB2 key hash (closes #1394)

This commit is contained in:
Sébastien Helleu
2019-08-19 23:29:22 +02:00
parent 80f103b68a
commit 7f62985f89
3 changed files with 11 additions and 5 deletions
+8 -3
View File
@@ -28,9 +28,11 @@ extern "C"
#include "src/plugins/plugin.h"
}
#define HASHTABLE_TEST_KEY "test"
#define HASHTABLE_TEST_KEY_HASH 5849825121ULL
#define HASHTABLE_TEST_VALUE "this is a value"
#define HASHTABLE_TEST_KEY "test"
#define HASHTABLE_TEST_KEY_HASH 5849825121ULL
#define HASHTABLE_TEST_KEY_LONG "abcdefghijklmnopqrstuvwxyz"
#define HASHTABLE_TEST_KEY_LONG_HASH 11232856562070989738ULL
#define HASHTABLE_TEST_VALUE "this is a value"
TEST_GROUP(CoreHashtable)
{
@@ -47,6 +49,9 @@ TEST(CoreHashtable, HashDbj2)
hash = hashtable_hash_key_djb2 (HASHTABLE_TEST_KEY);
CHECK(hash == HASHTABLE_TEST_KEY_HASH);
hash = hashtable_hash_key_djb2 (HASHTABLE_TEST_KEY_LONG);
CHECK(hash == HASHTABLE_TEST_KEY_LONG_HASH);
}
/*