Lines Matching refs:hashSet
87 static size_t ZSTD_DDictHashSet_getIndex(const ZSTD_DDictHashSet* hashSet, U32 dictID) { in ZSTD_DDictHashSet_getIndex() argument
90 return hash & (hashSet->ddictPtrTableSize - 1); in ZSTD_DDictHashSet_getIndex()
97 static size_t ZSTD_DDictHashSet_emplaceDDict(ZSTD_DDictHashSet* hashSet, const ZSTD_DDict* ddict) { in ZSTD_DDictHashSet_emplaceDDict() argument
99 size_t idx = ZSTD_DDictHashSet_getIndex(hashSet, dictID); in ZSTD_DDictHashSet_emplaceDDict()
100 const size_t idxRangeMask = hashSet->ddictPtrTableSize - 1; in ZSTD_DDictHashSet_emplaceDDict()
101 …RETURN_ERROR_IF(hashSet->ddictPtrCount == hashSet->ddictPtrTableSize, GENERIC, "Hash set is full!"… in ZSTD_DDictHashSet_emplaceDDict()
103 while (hashSet->ddictPtrTable[idx] != NULL) { in ZSTD_DDictHashSet_emplaceDDict()
105 if (ZSTD_getDictID_fromDDict(hashSet->ddictPtrTable[idx]) == dictID) { in ZSTD_DDictHashSet_emplaceDDict()
107 hashSet->ddictPtrTable[idx] = ddict; in ZSTD_DDictHashSet_emplaceDDict()
114 hashSet->ddictPtrTable[idx] = ddict; in ZSTD_DDictHashSet_emplaceDDict()
115 hashSet->ddictPtrCount++; in ZSTD_DDictHashSet_emplaceDDict()
123 static size_t ZSTD_DDictHashSet_expand(ZSTD_DDictHashSet* hashSet, ZSTD_customMem customMem) { in ZSTD_DDictHashSet_expand() argument
124 size_t newTableSize = hashSet->ddictPtrTableSize * DDICT_HASHSET_RESIZE_FACTOR; in ZSTD_DDictHashSet_expand()
126 const ZSTD_DDict** oldTable = hashSet->ddictPtrTable; in ZSTD_DDictHashSet_expand()
127 size_t oldTableSize = hashSet->ddictPtrTableSize; in ZSTD_DDictHashSet_expand()
132 hashSet->ddictPtrTable = newTable; in ZSTD_DDictHashSet_expand()
133 hashSet->ddictPtrTableSize = newTableSize; in ZSTD_DDictHashSet_expand()
134 hashSet->ddictPtrCount = 0; in ZSTD_DDictHashSet_expand()
137 FORWARD_IF_ERROR(ZSTD_DDictHashSet_emplaceDDict(hashSet, oldTable[i]), ""); in ZSTD_DDictHashSet_expand()
148 static const ZSTD_DDict* ZSTD_DDictHashSet_getDDict(ZSTD_DDictHashSet* hashSet, U32 dictID) { in ZSTD_DDictHashSet_getDDict() argument
149 size_t idx = ZSTD_DDictHashSet_getIndex(hashSet, dictID); in ZSTD_DDictHashSet_getDDict()
150 const size_t idxRangeMask = hashSet->ddictPtrTableSize - 1; in ZSTD_DDictHashSet_getDDict()
153 size_t currDictID = ZSTD_getDictID_fromDDict(hashSet->ddictPtrTable[idx]); in ZSTD_DDictHashSet_getDDict()
163 return hashSet->ddictPtrTable[idx]; in ZSTD_DDictHashSet_getDDict()
188 static void ZSTD_freeDDictHashSet(ZSTD_DDictHashSet* hashSet, ZSTD_customMem customMem) { in ZSTD_freeDDictHashSet() argument
190 if (hashSet && hashSet->ddictPtrTable) { in ZSTD_freeDDictHashSet()
191 ZSTD_customFree((void*)hashSet->ddictPtrTable, customMem); in ZSTD_freeDDictHashSet()
193 if (hashSet) { in ZSTD_freeDDictHashSet()
194 ZSTD_customFree(hashSet, customMem); in ZSTD_freeDDictHashSet()
201 static size_t ZSTD_DDictHashSet_addDDict(ZSTD_DDictHashSet* hashSet, const ZSTD_DDict* ddict, ZSTD_… in ZSTD_DDictHashSet_addDDict() argument
202 …Count: %zu Tablesize: %zu", ZSTD_getDictID_fromDDict(ddict), hashSet->ddictPtrCount, hashSet->ddic… in ZSTD_DDictHashSet_addDDict()
203 …if (hashSet->ddictPtrCount * DDICT_HASHSET_MAX_LOAD_FACTOR_COUNT_MULT / hashSet->ddictPtrTableSize… in ZSTD_DDictHashSet_addDDict()
204 FORWARD_IF_ERROR(ZSTD_DDictHashSet_expand(hashSet, customMem), ""); in ZSTD_DDictHashSet_addDDict()
206 FORWARD_IF_ERROR(ZSTD_DDictHashSet_emplaceDDict(hashSet, ddict), ""); in ZSTD_DDictHashSet_addDDict()