Lines Matching +defs:hash +defs:table

42 LFUNC(HashTableGrows, int, (xpmHashTable * table));
60 * hash table routines *
66 * HASH_FUNCTION: hash function, hash = hashcode, hp = pointer on char,
69 * HASH_TABLE_GROWS how hash table grows.
73 #define HASH_FUNCTION hash = (hash << 5) - hash + *hp++;
80 #define HASH_FUNCTION hash <<= 4; hash += *hp++; \
81 if(hash2 = hash & 0xf0000000) hash ^= (hash2 >> 24) ^ hash2;
88 #define HASH_FUNCTION hash = (hash << 3) + (hash >> 28) + *hp++;
93 /* end of hash functions */
96 * The hash table is used to store atoms via their NAME:
98 * NAME --hash--> ATOM |--name--> "foo"
111 xpmHashTable *table,
114 xpmHashAtom *atomTable = table->atomTable;
115 unsigned int hash;
120 hash = 0;
121 while (*hp) { /* computes hash function */
124 p = atomTable + hash % table->size;
131 p = atomTable + table->size - 1;
137 HashTableGrows(xpmHashTable *table)
139 xpmHashAtom *atomTable = table->atomTable;
140 unsigned int size = table->size;
147 table->size = size;
148 table->limit = size / 3;
154 table->atomTable = atomTable;
159 xpmHashAtom *ps = xpmHashSlot(table, (*p)->name);
168 * xpmHashIntern(table, name, data)
174 xpmHashTable *table,
180 if (!*(slot = xpmHashSlot(table, tag))) {
184 if (table->used >= table->limit) {
187 if ((ErrorStatus = HashTableGrows(table)) != XpmSuccess)
189 table->used++;
192 table->used++;
202 xpmHashTableInit(xpmHashTable *table)
207 table->size = INITIAL_HASH_SIZE;
208 table->limit = table->size / 3;
209 table->used = 0;
210 table->atomTable = NULL;
211 if (table->size >= UINT_MAX / sizeof(*atomTable))
213 atomTable = (xpmHashAtom *) XpmMalloc(table->size * sizeof(*atomTable));
216 for (p = atomTable + table->size; p > atomTable;)
218 table->atomTable = atomTable;
227 xpmHashTableFree(xpmHashTable *table)
230 xpmHashAtom *atomTable = table->atomTable;
234 for (p = atomTable + table->size; p > atomTable;)
238 table->atomTable = NULL;