ELinks 0.16.1.1
hash.c File Reference

Hashing infrastructure. More...

#include <string.h>
#include "elinks.h"
#include "util/hash.h"
#include "util/memory.h"
Include dependency graph for hash.c:

Macros

#define X31_HASH   /* Weaker but faster */
#define hash_mask(n)
#define hash_size(n)
#define HASH_MAGIC   0xdeadbeef
 Initialization vector for the hash function.

Functions

static hash_value_T strhash (const char *k, unsigned int length, hash_value_T initval)
 Fast string hashing.
static struct hashinit_hash (unsigned int width, hash_func_T func)

Detailed Description

Hashing infrastructure.

Macro Definition Documentation

◆ HASH_MAGIC

#define HASH_MAGIC   0xdeadbeef

Initialization vector for the hash function.

I've no much idea about what to set here.. I think it doesn't matter much anyway.. ;) –pasky

◆ hash_mask

#define hash_mask ( n)
Value:
(hash_size(n) - 1)
int n
Definition general.c:825
#define hash_size(n)
Definition hash.c:26

◆ hash_size

#define hash_size ( n)
Value:
(1 << (n))

◆ X31_HASH

#define X31_HASH   /* Weaker but faster */

Function Documentation

◆ init_hash()

struct hash * init_hash ( unsigned int width,
hash_func_T func )
inlinestatic

◆ strhash()

hash_value_T strhash ( const char * k,
unsigned int length,
hash_value_T initval )
static

Fast string hashing.

Parameters
kthe key
lengththe length of the key
initvalthe previous hash, or an arbitrary value