aboutsummaryrefslogtreecommitdiff
path: root/src/hash.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-07-10 01:45:07 +0000
committerMike Buland <eichlan@xagasoft.com>2007-07-10 01:45:07 +0000
commit32c48edc85e05bedc6324109e8a5429767dda42a (patch)
tree260535d410e450f419b81b539fb3e9c010fdca40 /src/hash.h
parent96a0e186d535d761d6b24ef3e929a6710e4b0cea (diff)
downloadlibbu++-32c48edc85e05bedc6324109e8a5429767dda42a.tar.gz
libbu++-32c48edc85e05bedc6324109e8a5429767dda42a.tar.bz2
libbu++-32c48edc85e05bedc6324109e8a5429767dda42a.tar.xz
libbu++-32c48edc85e05bedc6324109e8a5429767dda42a.zip
I Fixed the Hash bug!!!
Diffstat (limited to 'src/hash.h')
-rw-r--r--src/hash.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/hash.h b/src/hash.h
index f183823..36665a6 100644
--- a/src/hash.h
+++ b/src/hash.h
@@ -856,7 +856,8 @@ namespace Bu
856 856
857 // First we scan to see if the key is already there, abort if we 857 // First we scan to see if the key is already there, abort if we
858 // run out of probing room, or we find a non-filled entry 858 // run out of probing room, or we find a non-filled entry
859 for( int8_t j = 0; 859 int8_t j;
860 for( j = 0;
860 isFilled( nCur ) && j < 32; 861 isFilled( nCur ) && j < 32;
861 nCur = (nCur + (1<<j))%nCapacity, j++ 862 nCur = (nCur + (1<<j))%nCapacity, j++
862 ) 863 )
@@ -880,7 +881,7 @@ namespace Bu
880 881
881 // This is our insurance, if the table is full, then go ahead and 882 // This is our insurance, if the table is full, then go ahead and
882 // rehash, then try again. 883 // rehash, then try again.
883 if( isFilled( nCur ) && rehash == true ) 884 if( (isFilled( nCur ) || j == 32) && rehash == true )
884 { 885 {
885 reHash( szCalc(getCapacity(), getFill(), getDeleted()) ); 886 reHash( szCalc(getCapacity(), getFill(), getDeleted()) );
886 887