Asterisk - The Open Source Telephony Project  18.5.0
Macros | Functions
hash_func.c File Reference
#include <sys/types.h>
#include "../include/db.h"
#include "hash.h"
#include "page.h"
#include "extern.h"
Include dependency graph for hash_func.c:

Go to the source code of this file.

Macros

#define HASH4   HASH4b
 
#define HASH4_TOREK   1
 
#define HASH4a   h = (h << 5) - h + *key++;
 
#define HASH4b   h = (h << 5) + h + *key++;
 

Functions

static u_int32_t hashfunc __P ((const void *, size_t))
 
static u_int32_t hashfunc (void *keyarg, size_t len) const
 

Macro Definition Documentation

◆ HASH4

#define HASH4   HASH4b

Referenced by hashfunc().

◆ HASH4_TOREK

#define HASH4_TOREK   1

Definition at line 52 of file hash_func.c.

◆ HASH4a

#define HASH4a   h = (h << 5) - h + *key++;

◆ HASH4b

#define HASH4b   h = (h << 5) + h + *key++;

Function Documentation

◆ __P()

static u_int32_t hashfunc __P ( (const void *, size_t)  )
static

◆ hashfunc()

static u_int32_t hashfunc ( void *  keyarg,
size_t  len 
) const
static

Definition at line 178 of file hash_func.c.

References HASH4.

181 {
182  register const u_char *key;
183  register size_t loop;
184  register u_int32_t h;
185 
186 #define HASH4a h = (h << 5) - h + *key++;
187 #define HASH4b h = (h << 5) + h + *key++;
188 #define HASH4 HASH4b
189 
190  h = 0;
191  key = keyarg;
192  if (len > 0) {
193  loop = (len + 8 - 1) >> 3;
194 
195  switch (len & (8 - 1)) {
196  case 0:
197  do {
198  HASH4;
199  /* FALLTHROUGH */
200  case 7:
201  HASH4;
202  /* FALLTHROUGH */
203  case 6:
204  HASH4;
205  /* FALLTHROUGH */
206  case 5:
207  HASH4;
208  /* FALLTHROUGH */
209  case 4:
210  HASH4;
211  /* FALLTHROUGH */
212  case 3:
213  HASH4;
214  /* FALLTHROUGH */
215  case 2:
216  HASH4;
217  /* FALLTHROUGH */
218  case 1:
219  HASH4;
220  } while (--loop);
221  }
222  }
223  return (h);
224 }
#define HASH4
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
unsigned int u_int32_t