Lines Matching refs:hash
91 const TYPENAME* hash; \
98 void TYPENAME##_reset (DE_PTR_TYPE(TYPENAME) hash); \
99 deBool TYPENAME##_reserve (DE_PTR_TYPE(TYPENAME) hash, int capacity); \
100 VALUETYPE* TYPENAME##_find (const TYPENAME* hash, KEYTYPE key); \
101 deBool TYPENAME##_insert (DE_PTR_TYPE(TYPENAME) hash, KEYTYPE key, VALUETYPE value); \
102 void TYPENAME##_delete (DE_PTR_TYPE(TYPENAME) hash, KEYTYPE key); \
104 DE_INLINE int TYPENAME##_getNumElements (const TYPENAME* hash) DE_UNUSED_FUNCTION; \
105 DE_INLINE void TYPENAME##Iter_init (const TYPENAME* hash, TYPENAME##Iter* iter) DE_UNUSED_FUNCTI…
111 DE_INLINE int TYPENAME##_getNumElements (const TYPENAME* hash) \
113 return hash->numElements; \
116 DE_INLINE void TYPENAME##Iter_init (const TYPENAME* hash, TYPENAME##Iter* iter) \
118 iter->hash = hash; \
122 if (TYPENAME##_getNumElements(hash) > 0) \
124 int slotTableSize = hash->slotTableSize; \
128 if (hash->slotTable[slotNdx]) \
134 iter->curSlot = hash->slotTable[slotNdx]; \
156 const TYPENAME* hash = iter->hash; \
158 int slotTableSize = hash->slotTableSize; \
161 if (hash->slotTable[curSlotIndex]) \
166 iter->curSlot = hash->slotTable[curSlotIndex]; \
205 DE_PTR_TYPE(TYPENAME) hash = DE_POOL_NEW(pool, TYPENAME); \
206 if (!hash) \
209 memset(hash, 0, sizeof(TYPENAME)); \
210 hash->pool = pool; \
212 return hash; \
215 void TYPENAME##_reset (DE_PTR_TYPE(TYPENAME) hash) \
218 for (slotNdx = 0; slotNdx < hash->slotTableSize; slotNdx++) \
220 TYPENAME##Slot* slot = hash->slotTable[slotNdx]; \
224 slot->nextSlot = hash->slotFreeList; \
225 hash->slotFreeList = slot; \
229 hash->slotTable[slotNdx] = DE_NULL; \
231 hash->numElements = 0; \
234 TYPENAME##Slot* TYPENAME##_allocSlot (DE_PTR_TYPE(TYPENAME) hash) \
237 if (hash->slotFreeList) \
239 slot = hash->slotFreeList; \
240 hash->slotFreeList = hash->slotFreeList->nextSlot; \
243 …slot = (TYPENAME##Slot*)deMemPool_alloc(hash->pool, sizeof(TYPENAME##Slot) * DE_HASH_ELEMENTS_PER_…
254 deBool TYPENAME##_rehash (DE_PTR_TYPE(TYPENAME) hash, int newSlotTableSize) \
257 if (newSlotTableSize > hash->slotTableSize) \
259 TYPENAME##Slot** oldSlotTable = hash->slotTable; \
260 …TYPENAME##Slot** newSlotTable = (TYPENAME##Slot**)deMemPool_alloc(hash->pool, sizeof(TYPENAME##Slo…
261 int oldSlotTableSize = hash->slotTableSize; \
273 hash->slotTableSize = newSlotTableSize; \
274 hash->slotTable = newSlotTable; \
285 hash->numElements--; \
286 if (!TYPENAME##_insert(hash, slot->keys[elemNdx], slot->values[elemNdx])) \
297 VALUETYPE* TYPENAME##_find (const TYPENAME* hash, KEYTYPE key) \
299 if (hash->numElements > 0) \
301 int slotNdx = (int)(HASHFUNC(key) & (deUint32)(hash->slotTableSize - 1)); \
302 TYPENAME##Slot* slot = hash->slotTable[slotNdx]; \
303 DE_ASSERT(deInBounds32(slotNdx, 0, hash->slotTableSize)); \
320 deBool TYPENAME##_insert (DE_PTR_TYPE(TYPENAME) hash, KEYTYPE key, VALUETYPE value) \
325 DE_ASSERT(!TYPENAME##_find(hash, key)); \
327 if ((hash->numElements + 1) >= hash->slotTableSize * DE_HASH_ELEMENTS_PER_SLOT) \
328 if (!TYPENAME##_rehash(hash, deMax32(4, 2*hash->slotTableSize))) \
331 slotNdx = (int)(HASHFUNC(key) & (deUint32)(hash->slotTableSize - 1)); \
332 DE_ASSERT(slotNdx >= 0 && slotNdx < hash->slotTableSize); \
333 slot = hash->slotTable[slotNdx]; \
337 slot = TYPENAME##_allocSlot(hash); \
339 hash->slotTable[slotNdx] = slot; \
350 TYPENAME##Slot* nextSlot = TYPENAME##_allocSlot(hash); \
361 hash->numElements++; \
367 void TYPENAME##_delete (DE_PTR_TYPE(TYPENAME) hash, KEYTYPE key) \
373 DE_ASSERT(hash->numElements > 0); \
374 slotNdx = (int)(HASHFUNC(key) & (deUint32)(hash->slotTableSize - 1)); \
375 DE_ASSERT(slotNdx >= 0 && slotNdx < hash->slotTableSize); \
376 slot = hash->slotTable[slotNdx]; \
403 hash->slotTable[slotNdx] = DE_NULL; \
405 lastSlot->nextSlot = hash->slotFreeList; \
406 hash->slotFreeList = lastSlot; \
409 hash->numElements--; \
428 deBool HASHTYPENAME##_copyToArray(const HASHTYPENAME* hash, DE_PTR_TYPE(KEYARRAYTYPENAME) keyArray,…
430 int numElements = hash->numElements; \
438 for (slotNdx = 0; slotNdx < hash->slotTableSize; slotNdx++) \
440 const HASHTYPENAME##Slot* slot = hash->slotTable[slotNdx]; \