Changeset 5832 for trunk/src/kernel32/ccollection.cpp
- Timestamp:
- May 30, 2001, 5:31:48 AM (24 years ago)
- 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:55phaller Exp $ */1 /* $Id: ccollection.cpp,v 1.3 2001-05-30 03:28:02 phaller Exp $ */ 2 2 3 3 /* … … 16 16 17 17 18 19 static 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 18 38 CCollection::CCollection(int iInitialSize) 19 39 { … … 720 740 int iNewSize = nextPrime(iElements); 721 741 742 setSize(iNewSize); 743 } 744 745 746 void CHashtableLookup::setSize(int iNewSize) 747 { 722 748 // check if rehashing is necessary at all 723 749 if (iSize == iNewSize) … … 766 792 // swap the tables 767 793 iSize = iNewSize; 794 delete [] parrLists; 795 768 796 parrLists = parrNew; 769 797 } … … 802 830 } 803 831 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.