aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2006-05-01 18:39:59 +0000
committerMike Buland <eichlan@xagasoft.com>2006-05-01 18:39:59 +0000
commit1587314e55ae761983803aa828addc6854bf4ad4 (patch)
treeb90f3697008b219ee29a7736784068575d13bd88
parentf7a9549bd6ad83f2e0bceec9cddacfa5e3f84a54 (diff)
downloadlibbu++-1587314e55ae761983803aa828addc6854bf4ad4.tar.gz
libbu++-1587314e55ae761983803aa828addc6854bf4ad4.tar.bz2
libbu++-1587314e55ae761983803aa828addc6854bf4ad4.tar.xz
libbu++-1587314e55ae761983803aa828addc6854bf4ad4.zip
Fixed a bug in the get code of the hashtable. It now performs probing correctly
according to the new high capacity duplicate probing algorithm.
Diffstat (limited to '')
-rw-r--r--src/hashtable.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/hashtable.cpp b/src/hashtable.cpp
index 9dfe653..49d9236 100644
--- a/src/hashtable.cpp
+++ b/src/hashtable.cpp
@@ -212,6 +212,27 @@ const void *HashTable::get( const void *id, unsigned long int nSkip )
212 } 212 }
213 } 213 }
214 214
215 if( bAllowDupes )
216 {
217 int nOldPos = nPos;
218 for( nPos++; nPos != nOldPos; nPos=(nPos+1)%nTableSize )
219 {
220 if( !isFilled( nPos ) ) return NULL;
221 if( hFunc->cmpIDs( id, aTable[nPos].id ) &&
222 aTable[nPos].bDeleted == false )
223 {
224 if( nSkip == 0 )
225 {
226 return aTable[nPos].data;
227 }
228 else
229 {
230 nSkip--;
231 }
232 }
233 }
234 }
235
215 return NULL; 236 return NULL;
216} 237}
217 238