Ignore:
Timestamp:
May 30, 2001, 5:31:48 AM (24 years ago)
Author:
phaller
Message:

.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/ccollection.cpp

    r5831 r5832  
    1 /* $Id: ccollection.cpp,v 1.2 2001-05-30 02:44:55 phaller Exp $ */
     1/* $Id: ccollection.cpp,v 1.3 2001-05-30 03:28:02 phaller Exp $ */
    22
    33/*
     
    1616
    1717
     18
     19static inline unsigned long _Optlink hashcode(int iRing, char *pszName)
     20{
     21    unsigned long h;
     22    unsigned char *t = (unsigned char*)pszName;
     23
     24    for (h = 0;
     25         *t;
     26         t++)
     27    {
     28        h = (h << 6);
     29        h += *t;
     30        h %= iRing;
     31    }
     32
     33    return h;
     34}
     35
     36
     37
    1838CCollection::CCollection(int iInitialSize)
    1939{
     
    720740    int iNewSize = nextPrime(iElements);
    721741
     742    setSize(iNewSize);
     743}
     744
     745
     746void  CHashtableLookup::setSize(int iNewSize)
     747{
    722748    // check if rehashing is necessary at all
    723749    if (iSize == iNewSize)
     
    766792    // swap the tables
    767793    iSize = iNewSize;
     794    delete [] parrLists;
     795
    768796    parrLists = parrNew;
    769797}
     
    802830}
    803831
    804 
    805 unsigned long hashcode(int iRing, char *pszName)
    806 {
    807     unsigned long h;
    808     unsigned char *t = (unsigned char*)pszName;
    809 
    810     for (h = 0;
    811          *t;
    812          t++)
    813     {
    814         h = (h << 6);
    815         h += *t;
    816         h %= iRing;
    817     }
    818 
    819     return h;
    820 }
Note: See TracChangeset for help on using the changeset viewer.