Lines Matching refs:hashSet

88 static size_t ZSTD_DDictHashSet_getIndex(const ZSTD_DDictHashSet* hashSet, U32 dictID) {  in ZSTD_DDictHashSet_getIndex()  argument
91 return hash & (hashSet->ddictPtrTableSize - 1); in ZSTD_DDictHashSet_getIndex()
98 static size_t ZSTD_DDictHashSet_emplaceDDict(ZSTD_DDictHashSet* hashSet, const ZSTD_DDict* ddict) { in ZSTD_DDictHashSet_emplaceDDict() argument
100 size_t idx = ZSTD_DDictHashSet_getIndex(hashSet, dictID); in ZSTD_DDictHashSet_emplaceDDict()
101 const size_t idxRangeMask = hashSet->ddictPtrTableSize - 1; in ZSTD_DDictHashSet_emplaceDDict()
102 …RETURN_ERROR_IF(hashSet->ddictPtrCount == hashSet->ddictPtrTableSize, GENERIC, "Hash set is full!"… in ZSTD_DDictHashSet_emplaceDDict()
104 while (hashSet->ddictPtrTable[idx] != NULL) { in ZSTD_DDictHashSet_emplaceDDict()
106 if (ZSTD_getDictID_fromDDict(hashSet->ddictPtrTable[idx]) == dictID) { in ZSTD_DDictHashSet_emplaceDDict()
108 hashSet->ddictPtrTable[idx] = ddict; in ZSTD_DDictHashSet_emplaceDDict()
115 hashSet->ddictPtrTable[idx] = ddict; in ZSTD_DDictHashSet_emplaceDDict()
116 hashSet->ddictPtrCount++; in ZSTD_DDictHashSet_emplaceDDict()
124 static size_t ZSTD_DDictHashSet_expand(ZSTD_DDictHashSet* hashSet, ZSTD_customMem customMem) { in ZSTD_DDictHashSet_expand() argument
125 size_t newTableSize = hashSet->ddictPtrTableSize * DDICT_HASHSET_RESIZE_FACTOR; in ZSTD_DDictHashSet_expand()
127 const ZSTD_DDict** oldTable = hashSet->ddictPtrTable; in ZSTD_DDictHashSet_expand()
128 size_t oldTableSize = hashSet->ddictPtrTableSize; in ZSTD_DDictHashSet_expand()
133 hashSet->ddictPtrTable = newTable; in ZSTD_DDictHashSet_expand()
134 hashSet->ddictPtrTableSize = newTableSize; in ZSTD_DDictHashSet_expand()
135 hashSet->ddictPtrCount = 0; in ZSTD_DDictHashSet_expand()
138 FORWARD_IF_ERROR(ZSTD_DDictHashSet_emplaceDDict(hashSet, oldTable[i]), ""); in ZSTD_DDictHashSet_expand()
149 static const ZSTD_DDict* ZSTD_DDictHashSet_getDDict(ZSTD_DDictHashSet* hashSet, U32 dictID) { in ZSTD_DDictHashSet_getDDict() argument
150 size_t idx = ZSTD_DDictHashSet_getIndex(hashSet, dictID); in ZSTD_DDictHashSet_getDDict()
151 const size_t idxRangeMask = hashSet->ddictPtrTableSize - 1; in ZSTD_DDictHashSet_getDDict()
154 size_t currDictID = ZSTD_getDictID_fromDDict(hashSet->ddictPtrTable[idx]); in ZSTD_DDictHashSet_getDDict()
164 return hashSet->ddictPtrTable[idx]; in ZSTD_DDictHashSet_getDDict()
189 static void ZSTD_freeDDictHashSet(ZSTD_DDictHashSet* hashSet, ZSTD_customMem customMem) { in ZSTD_freeDDictHashSet() argument
191 if (hashSet && hashSet->ddictPtrTable) { in ZSTD_freeDDictHashSet()
192 ZSTD_customFree((void*)hashSet->ddictPtrTable, customMem); in ZSTD_freeDDictHashSet()
194 if (hashSet) { in ZSTD_freeDDictHashSet()
195 ZSTD_customFree(hashSet, customMem); in ZSTD_freeDDictHashSet()
202 static size_t ZSTD_DDictHashSet_addDDict(ZSTD_DDictHashSet* hashSet, const ZSTD_DDict* ddict, ZSTD_… in ZSTD_DDictHashSet_addDDict() argument
203 …Count: %zu Tablesize: %zu", ZSTD_getDictID_fromDDict(ddict), hashSet->ddictPtrCount, hashSet->ddic… in ZSTD_DDictHashSet_addDDict()
204 …if (hashSet->ddictPtrCount * DDICT_HASHSET_MAX_LOAD_FACTOR_COUNT_MULT / hashSet->ddictPtrTableSize… in ZSTD_DDictHashSet_addDDict()
205 FORWARD_IF_ERROR(ZSTD_DDictHashSet_expand(hashSet, customMem), ""); in ZSTD_DDictHashSet_addDDict()
207 FORWARD_IF_ERROR(ZSTD_DDictHashSet_emplaceDDict(hashSet, ddict), ""); in ZSTD_DDictHashSet_addDDict()