73 53, 97, 193, 389, 769, 1543, 3079,
74 6151, 12289, 24593, 49157, 98317, 196613, 393241,
75 786433, 1572869, 3145739, 6291469, 12582917, 25165843, 50331653,
76 100663319, 201326611, 402653189, 805306457, 1610612741};
92 return (
unsigned long)(
uintptr_t)((
void *)(elt));
147 set->fnFreeEltFunc = fnFreeEltFunc;
155 set->nIndiceAllocatedSize = 0;
156 set->nAllocatedSize = 53;
158 set->nRecyclingListSize = 0;
159 set->bRehash =
false;
161 set->nCollisions = 0;
192 if (
set->psRecyclingList)
196 set->nRecyclingListSize--;
210 if (
set->nRecyclingListSize < 128)
213 set->psRecyclingList = psList;
214 set->nRecyclingListSize++;
229 for (
int i = 0;
i <
set->nAllocatedSize;
i++)
234 if (
set->fnFreeEltFunc)
235 set->fnFreeEltFunc(
cur->pData);
245 set->bRehash =
false;
313 set->nIndiceAllocatedSize = 0;
314 set->nAllocatedSize = 53;
316 set->nCollisions = 0;
341void TIFFHashSetForeach(
TIFFHashSet *
set, TIFFHashSetIterEltFunc fnIterFunc,
348 for (
int i = 0;
i <
set->nAllocatedSize;
i++)
368 int nNewAllocatedSize =
anPrimes[
set->nIndiceAllocatedSize];
371 if (newTabList ==
NULL)
374 TIFFDebug(
"TIFFHASH",
375 "hashSet=%p, nSize=%d, nCollisions=%d, "
376 "fCollisionRate=%.02f",
378 set->nCollisions * 100.0 /
set->nSize);
379 set->nCollisions = 0;
381 for (
int i = 0;
i <
set->nAllocatedSize;
i++)
386 const unsigned long nNewHashVal =
387 set->fnHashFunc(
cur->pData) % nNewAllocatedSize;
389 if (newTabList[nNewHashVal])
393 cur->psNext = newTabList[nNewHashVal];
394 newTabList[nNewHashVal] =
cur;
399 set->tabList = newTabList;
400 set->nAllocatedSize = nNewAllocatedSize;
401 set->bRehash =
false;
411 const unsigned long nHashVal =
set->fnHashFunc(elt) %
set->nAllocatedSize;
415 if (
set->fnEqualFunc(
cur->pData, elt))
446 if (
set->fnFreeEltFunc)
447 set->fnFreeEltFunc(*pElt);
453 if (
set->nSize >= 2 *
set->nAllocatedSize / 3 ||
454 (
set->bRehash &&
set->nIndiceAllocatedSize > 0 &&
455 set->nSize <=
set->nAllocatedSize / 2))
457 set->nIndiceAllocatedSize++;
460 set->nIndiceAllocatedSize--;
461 if (
set->fnFreeEltFunc)
462 set->fnFreeEltFunc(elt);
467 const unsigned long nHashVal =
set->fnHashFunc(elt) %
set->nAllocatedSize;
469 if (
set->tabList[nHashVal])
476 if (
set->fnFreeEltFunc)
477 set->fnFreeEltFunc(elt);
480 new_elt->
pData = elt;
481 new_elt->
psNext =
set->tabList[nHashVal];
482 set->tabList[nHashVal] = new_elt;
520 if (
set->nIndiceAllocatedSize > 0 &&
set->nSize <=
set->nAllocatedSize / 2)
522 set->nIndiceAllocatedSize--;
529 set->nIndiceAllocatedSize++;
535 int nHashVal = (
int)(
set->fnHashFunc(elt) %
set->nAllocatedSize);
540 if (
set->fnEqualFunc(
cur->pData, elt))
545 set->tabList[nHashVal] =
cur->psNext;
547 if (
set->fnFreeEltFunc)
548 set->fnFreeEltFunc(
cur->pData);
552 if (
set->tabList[nHashVal])
599bool TIFFHashSetRemoveDeferRehash(
TIFFHashSet *
set,
const void *elt)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
TIFFList * psRecyclingList
TIFFHashSetEqualFunc fnEqualFunc
TIFFHashSetFreeEltFunc fnFreeEltFunc
TIFFHashSetHashFunc fnHashFunc
struct _TIFFList * psNext
static void TIFFHashSetReturnListElt(TIFFHashSet *set, TIFFList *psList)
static unsigned long TIFFHashSetHashPointer(const void *elt)
void * TIFFHashSetLookup(TIFFHashSet *set, const void *elt)
bool TIFFHashSetInsert(TIFFHashSet *set, void *elt)
bool TIFFHashSetRemove(TIFFHashSet *set, const void *elt)
int TIFFHashSetSize(const TIFFHashSet *set)
TIFFHashSet * TIFFHashSetNew(TIFFHashSetHashFunc fnHashFunc, TIFFHashSetEqualFunc fnEqualFunc, TIFFHashSetFreeEltFunc fnFreeEltFunc)
static TIFFList * TIFFHashSetGetNewListElt(TIFFHashSet *set)
static bool TIFFHashSetEqualPointer(const void *elt1, const void *elt2)
void TIFFHashSetDestroy(TIFFHashSet *set)
static const int anPrimes[]
static void TIFFListDestroy(TIFFList *psList)
static void ** TIFFHashSetFindPtr(TIFFHashSet *set, const void *elt)
static bool TIFFHashSetRemoveInternal(TIFFHashSet *set, const void *elt, bool bDeferRehash)
static void TIFFHashSetClearInternal(TIFFHashSet *set, bool bFinalize)
static bool TIFFHashSetRehash(TIFFHashSet *set)
bool(* TIFFHashSetEqualFunc)(const void *elt1, const void *elt2)
void(* TIFFHashSetFreeEltFunc)(void *elt)
unsigned long(* TIFFHashSetHashFunc)(const void *elt)