diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2021-07-23 16:43:57 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2021-07-23 16:43:57 +0000 |
commit | dd6bb6c6b8298ebeff2d1882becb36580b969d6f (patch) | |
tree | 3d922a5791e7e34e2b041ea5f3489360bfa798e1 /src/libstddjb/cdb_hash.c | |
parent | 122f9363682e5de8ce4056c4c05c1eaf8935cf19 (diff) | |
download | skalibs-dd6bb6c6b8298ebeff2d1882becb36580b969d6f.tar.xz |
New 2.11.0.0 branch with several modifications
- libbiguint removed
- cdb_make changed to cdbmake (because different ui)
- cdb redesigned
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libstddjb/cdb_hash.c')
-rw-r--r-- | src/libstddjb/cdb_hash.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libstddjb/cdb_hash.c b/src/libstddjb/cdb_hash.c index 82dcfbc..a7b626b 100644 --- a/src/libstddjb/cdb_hash.c +++ b/src/libstddjb/cdb_hash.c @@ -1,14 +1,18 @@ /* ISC license. */ -#include <skalibs/cdb.h> +#include <stdint.h> -uint32_t cdb_hashadd (uint32_t h, unsigned char c) +#include "cdb-internal.h" + +#define CDB_HASHSTART 5381 + +static inline uint32_t cdb_hashadd (uint32_t h, unsigned char c) { h += (h << 5) ; return h ^ c ; } -uint32_t cdb_hash (char const *buf, unsigned int len) +uint32_t cdb_hash (char const *buf, uint32_t len) { uint32_t h = CDB_HASHSTART ; while (len--) h = cdb_hashadd(h, *buf++) ; |