summaryrefslogtreecommitdiff
path: root/src/hashtable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/hashtable.cpp')
-rw-r--r--src/hashtable.cpp72
1 files changed, 40 insertions, 32 deletions
diff --git a/src/hashtable.cpp b/src/hashtable.cpp
index ea13236..37c3149 100644
--- a/src/hashtable.cpp
+++ b/src/hashtable.cpp
@@ -203,16 +203,18 @@ const void *HashTable::get( const void *id, unsigned long int nSkip )
203 for( unsigned long int j=0; j < 32; nPos = (nPos+(1<<j))%nTableSize, j++ ) 203 for( unsigned long int j=0; j < 32; nPos = (nPos+(1<<j))%nTableSize, j++ )
204 { 204 {
205 if( !isFilled( nPos ) ) return NULL; 205 if( !isFilled( nPos ) ) return NULL;
206 if( hFunc->cmpIDs( id, aTable[nPos].id ) && 206 if( aTable[nPos].bDeleted == false )
207 aTable[nPos].bDeleted == false )
208 { 207 {
209 if( nSkip == 0 ) 208 if( hFunc->cmpIDs( id, aTable[nPos].id ) )
210 {
211 return aTable[nPos].data;
212 }
213 else
214 { 209 {
215 nSkip--; 210 if( nSkip == 0 )
211 {
212 return aTable[nPos].data;
213 }
214 else
215 {
216 nSkip--;
217 }
216 } 218 }
217 } 219 }
218 } 220 }
@@ -223,16 +225,18 @@ const void *HashTable::get( const void *id, unsigned long int nSkip )
223 for( nPos++; nPos != nOldPos; nPos=(nPos+1)%nTableSize ) 225 for( nPos++; nPos != nOldPos; nPos=(nPos+1)%nTableSize )
224 { 226 {
225 if( !isFilled( nPos ) ) return NULL; 227 if( !isFilled( nPos ) ) return NULL;
226 if( hFunc->cmpIDs( id, aTable[nPos].id ) && 228 if( aTable[nPos].bDeleted == false )
227 aTable[nPos].bDeleted == false )
228 { 229 {
229 if( nSkip == 0 ) 230 if( hFunc->cmpIDs( id, aTable[nPos].id ) )
230 { 231 {
231 return aTable[nPos].data; 232 if( nSkip == 0 )
232 } 233 {
233 else 234 return aTable[nPos].data;
234 { 235 }
235 nSkip--; 236 else
237 {
238 nSkip--;
239 }
236 } 240 }
237 } 241 }
238 } 242 }
@@ -248,16 +252,18 @@ const void *HashTable::getKey( const void *id, unsigned long int nSkip )
248 for( unsigned long int j=0; j < 32; nPos = (nPos+(1<<j))%nTableSize, j++ ) 252 for( unsigned long int j=0; j < 32; nPos = (nPos+(1<<j))%nTableSize, j++ )
249 { 253 {
250 if( !isFilled( nPos ) ) return NULL; 254 if( !isFilled( nPos ) ) return NULL;
251 if( hFunc->cmpIDs( id, aTable[nPos].id ) && 255 if( aTable[nPos].bDeleted == false )
252 aTable[nPos].bDeleted == false )
253 { 256 {
254 if( nSkip == 0 ) 257 if( hFunc->cmpIDs( id, aTable[nPos].id ) )
255 {
256 return aTable[nPos].id;
257 }
258 else
259 { 258 {
260 nSkip--; 259 if( nSkip == 0 )
260 {
261 return aTable[nPos].id;
262 }
263 else
264 {
265 nSkip--;
266 }
261 } 267 }
262 } 268 }
263 } 269 }
@@ -268,16 +274,18 @@ const void *HashTable::getKey( const void *id, unsigned long int nSkip )
268 for( nPos++; nPos != nOldPos; nPos=(nPos+1)%nTableSize ) 274 for( nPos++; nPos != nOldPos; nPos=(nPos+1)%nTableSize )
269 { 275 {
270 if( !isFilled( nPos ) ) return NULL; 276 if( !isFilled( nPos ) ) return NULL;
271 if( hFunc->cmpIDs( id, aTable[nPos].id ) && 277 if( aTable[nPos].bDeleted == false )
272 aTable[nPos].bDeleted == false )
273 { 278 {
274 if( nSkip == 0 ) 279 if( hFunc->cmpIDs( id, aTable[nPos].id ) )
275 { 280 {
276 return aTable[nPos].id; 281 if( nSkip == 0 )
277 } 282 {
278 else 283 return aTable[nPos].id;
279 { 284 }
280 nSkip--; 285 else
286 {
287 nSkip--;
288 }
281 } 289 }
282 } 290 }
283 } 291 }