Classes | Defines | Typedefs | Enumerations | Functions

jsdhash.h File Reference

#include "jstypes.h"
Include dependency graph for jsdhash.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  JSDHashEntryHdr
struct  JSDHashTable
struct  JSDHashTableOps
struct  JSDHashEntryStub

Defines

#define JS_DHASH_FASTCALL
#define JS_DHASH_SIZE_LIMIT   JS_BIT(24)
#define JS_DHASH_MIN_SIZE   16
#define JS_DHASH_BITS   32
#define JS_DHASH_GOLDEN_RATIO   0x9E3779B9U
#define JS_DHASH_ENTRY_IS_FREE(entry)   ((entry)->keyHash == 0)
#define JS_DHASH_ENTRY_IS_BUSY(entry)   (!JS_DHASH_ENTRY_IS_FREE(entry))
#define JS_DHASH_ENTRY_IS_LIVE(entry)   ((entry)->keyHash >= 2)
#define JS_DHASH_TABLE_SIZE(table)   JS_BIT(JS_DHASH_BITS - (table)->hashShift)
#define JS_DHASH_MIN_ALPHA(table, k)
#define JS_DHASH_DEFAULT_MAX_ALPHA   0.75
#define JS_DHASH_DEFAULT_MIN_ALPHA   0.25
#define JS_DHASH_CAP(entryCount, maxAlpha)   ((uint32)((double)(entryCount) / (maxAlpha)))
#define JS_DHASH_CAPACITY(entryCount, maxAlpha)
#define JS_DHASH_DEFAULT_CAPACITY(entryCount)   JS_DHASH_CAPACITY(entryCount, JS_DHASH_DEFAULT_MAX_ALPHA)

Typedefs

typedef uint32 JSDHashNumber
typedef struct JSDHashEntryHdr JSDHashEntryHdr
typedef struct JSDHashEntryStub JSDHashEntryStub
typedef struct JSDHashTable JSDHashTable
typedef struct JSDHashTableOps JSDHashTableOps
typedef void *(* JSDHashAllocTable )(JSDHashTable *table, uint32 nbytes)
typedef void(* JSDHashFreeTable )(JSDHashTable *table, void *ptr)
typedef JSDHashNumber(* JSDHashHashKey )(JSDHashTable *table, const void *key)
typedef JSBool(* JSDHashMatchEntry )(JSDHashTable *table, const JSDHashEntryHdr *entry, const void *key)
typedef void(* JSDHashMoveEntry )(JSDHashTable *table, const JSDHashEntryHdr *from, JSDHashEntryHdr *to)
typedef void(* JSDHashClearEntry )(JSDHashTable *table, JSDHashEntryHdr *entry)
typedef void(* JSDHashFinalize )(JSDHashTable *table)
typedef JSBool(* JSDHashInitEntry )(JSDHashTable *table, JSDHashEntryHdr *entry, const void *key)
typedef enum JSDHashOperator JSDHashOperator
typedef JSDHashOperator(* JSDHashEnumerator )(JSDHashTable *table, JSDHashEntryHdr *hdr, uint32 number, void *arg)

Enumerations

enum  JSDHashOperator {
  JS_DHASH_LOOKUP = 0, JS_DHASH_ADD = 1, JS_DHASH_REMOVE = 2, JS_DHASH_NEXT = 0,
  JS_DHASH_STOP = 1
}

Functions

void * JS_DHashAllocTable (JSDHashTable *table, uint32 nbytes)
void JS_DHashFreeTable (JSDHashTable *table, void *ptr)
JSDHashNumber JS_DHashStringKey (JSDHashTable *table, const void *key)
JSDHashNumber JS_DHashVoidPtrKeyStub (JSDHashTable *table, const void *key)
JSBool JS_DHashMatchEntryStub (JSDHashTable *table, const JSDHashEntryHdr *entry, const void *key)
JSBool JS_DHashMatchStringKey (JSDHashTable *table, const JSDHashEntryHdr *entry, const void *key)
void JS_DHashMoveEntryStub (JSDHashTable *table, const JSDHashEntryHdr *from, JSDHashEntryHdr *to)
void JS_DHashClearEntryStub (JSDHashTable *table, JSDHashEntryHdr *entry)
void JS_DHashFreeStringKey (JSDHashTable *table, JSDHashEntryHdr *entry)
void JS_DHashFinalizeStub (JSDHashTable *table)
const JSDHashTableOpsJS_DHashGetStubOps (void)
JSDHashTableJS_NewDHashTable (const JSDHashTableOps *ops, void *data, uint32 entrySize, uint32 capacity)
void JS_DHashTableDestroy (JSDHashTable *table)
JSBool JS_DHashTableInit (JSDHashTable *table, const JSDHashTableOps *ops, void *data, uint32 entrySize, uint32 capacity)
void JS_DHashTableSetAlphaBounds (JSDHashTable *table, float maxAlpha, float minAlpha)
void JS_DHashTableFinish (JSDHashTable *table)
JSDHashEntryHdrJS_DHashTableOperate (JSDHashTable *table, const void *key, JSDHashOperator op)
void JS_DHashTableRawRemove (JSDHashTable *table, JSDHashEntryHdr *entry)
uint32 JS_DHashTableEnumerate (JSDHashTable *table, JSDHashEnumerator etor, void *arg)

Define Documentation

#define JS_DHASH_BITS   32
#define JS_DHASH_CAP (   entryCount,
  maxAlpha 
)    ((uint32)((double)(entryCount) / (maxAlpha)))
#define JS_DHASH_CAPACITY (   entryCount,
  maxAlpha 
)
Value:
(JS_DHASH_CAP(entryCount, maxAlpha) +                                     \
     (((JS_DHASH_CAP(entryCount, maxAlpha) * (uint8)(0x100 * (maxAlpha)))     \
       >> 8) < (entryCount)))
#define JS_DHASH_DEFAULT_CAPACITY (   entryCount  )     JS_DHASH_CAPACITY(entryCount, JS_DHASH_DEFAULT_MAX_ALPHA)
#define JS_DHASH_DEFAULT_MAX_ALPHA   0.75
#define JS_DHASH_DEFAULT_MIN_ALPHA   0.25
#define JS_DHASH_ENTRY_IS_BUSY (   entry  )     (!JS_DHASH_ENTRY_IS_FREE(entry))
#define JS_DHASH_ENTRY_IS_FREE (   entry  )     ((entry)->keyHash == 0)
#define JS_DHASH_ENTRY_IS_LIVE (   entry  )     ((entry)->keyHash >= 2)
#define JS_DHASH_FASTCALL
#define JS_DHASH_GOLDEN_RATIO   0x9E3779B9U
#define JS_DHASH_MIN_ALPHA (   table,
  k 
)
Value:
((float)((table)->entrySize / sizeof(void *) - 1)                         \
     / ((table)->entrySize / sizeof(void *) + (k)))
#define JS_DHASH_MIN_SIZE   16
#define JS_DHASH_SIZE_LIMIT   JS_BIT(24)
#define JS_DHASH_TABLE_SIZE (   table  )     JS_BIT(JS_DHASH_BITS - (table)->hashShift)

Typedef Documentation

typedef void*(* JSDHashAllocTable)(JSDHashTable *table, uint32 nbytes)
typedef void(* JSDHashClearEntry)(JSDHashTable *table, JSDHashEntryHdr *entry)
typedef JSDHashOperator(* JSDHashEnumerator)(JSDHashTable *table, JSDHashEntryHdr *hdr, uint32 number, void *arg)
typedef void(* JSDHashFinalize)(JSDHashTable *table)
typedef void(* JSDHashFreeTable)(JSDHashTable *table, void *ptr)
typedef JSDHashNumber(* JSDHashHashKey)(JSDHashTable *table, const void *key)
typedef JSBool(* JSDHashInitEntry)(JSDHashTable *table, JSDHashEntryHdr *entry, const void *key)
typedef JSBool(* JSDHashMatchEntry)(JSDHashTable *table, const JSDHashEntryHdr *entry, const void *key)
typedef void(* JSDHashMoveEntry)(JSDHashTable *table, const JSDHashEntryHdr *from, JSDHashEntryHdr *to)
typedef struct JSDHashTable JSDHashTable

Enumeration Type Documentation

Enumerator:
JS_DHASH_LOOKUP 
JS_DHASH_ADD 
JS_DHASH_REMOVE 
JS_DHASH_NEXT 
JS_DHASH_STOP 

Function Documentation

void* JS_DHashAllocTable ( JSDHashTable table,
uint32  nbytes 
)
void JS_DHashClearEntryStub ( JSDHashTable table,
JSDHashEntryHdr entry 
)
void JS_DHashFinalizeStub ( JSDHashTable table  ) 
void JS_DHashFreeStringKey ( JSDHashTable table,
JSDHashEntryHdr entry 
)
void JS_DHashFreeTable ( JSDHashTable table,
void *  ptr 
)
const JSDHashTableOps* JS_DHashGetStubOps ( void   ) 
JSBool JS_DHashMatchEntryStub ( JSDHashTable table,
const JSDHashEntryHdr entry,
const void *  key 
)
JSBool JS_DHashMatchStringKey ( JSDHashTable table,
const JSDHashEntryHdr entry,
const void *  key 
)
void JS_DHashMoveEntryStub ( JSDHashTable table,
const JSDHashEntryHdr from,
JSDHashEntryHdr to 
)
JSDHashNumber JS_DHashStringKey ( JSDHashTable table,
const void *  key 
)
void JS_DHashTableDestroy ( JSDHashTable table  ) 
uint32 JS_DHashTableEnumerate ( JSDHashTable table,
JSDHashEnumerator  etor,
void *  arg 
)
void JS_DHashTableFinish ( JSDHashTable table  ) 
JSBool JS_DHashTableInit ( JSDHashTable table,
const JSDHashTableOps ops,
void *  data,
uint32  entrySize,
uint32  capacity 
)
JSDHashEntryHdr* JS_DHashTableOperate ( JSDHashTable table,
const void *  key,
JSDHashOperator  op 
)
void JS_DHashTableRawRemove ( JSDHashTable table,
JSDHashEntryHdr entry 
)
void JS_DHashTableSetAlphaBounds ( JSDHashTable table,
float  maxAlpha,
float  minAlpha 
)
JSDHashNumber JS_DHashVoidPtrKeyStub ( JSDHashTable table,
const void *  key 
)
JSDHashTable* JS_NewDHashTable ( const JSDHashTableOps ops,
void *  data,
uint32  entrySize,
uint32  capacity 
)