FreeSWITCH API Documentation  1.7.0
Data Structures | Macros | Functions
switch_hashtable_private.h File Reference
#include "switch_hashtable.h"
+ Include dependency graph for switch_hashtable_private.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  entry
 
struct  switch_hashtable_iterator
 
struct  switch_hashtable
 

Macros

#define freekey(X)   free(X)
 

Functions

static unsigned int hash (switch_hashtable_t *h, void *k)
 
static __inline__ unsigned int indexFor (unsigned int tablelength, unsigned int hashvalue)
 

Macro Definition Documentation

#define freekey (   X)    free(X)

Function Documentation

static unsigned int hash ( switch_hashtable_t h,
void *  k 
)
inlinestatic

Definition at line 49 of file switch_hashtable_private.h.

References switch_hashtable::hashfn.

50 {
51  /* Aim to protect against poor hash functions by adding logic here
52  * - logic taken from java 1.4 hashtable source */
53  unsigned int i = h->hashfn(k);
54  i += ~(i << 9);
55  i ^= ((i >> 14) | (i << 18)); /* >>> */
56  i += (i << 4);
57  i ^= ((i >> 10) | (i << 22)); /* >>> */
58  return i;
59 }
unsigned int(* hashfn)(void *k)
static __inline__ unsigned int indexFor ( unsigned int  tablelength,
unsigned int  hashvalue 
)
static

Definition at line 65 of file switch_hashtable_private.h.

Referenced by hashtable_expand(), switch_hashtable_insert_destructor(), switch_hashtable_remove(), and switch_hashtable_search().

65  {
66  return (hashvalue % tablelength);
67 }