diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-07-10 01:45:07 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-07-10 01:45:07 +0000 |
commit | 32c48edc85e05bedc6324109e8a5429767dda42a (patch) | |
tree | 260535d410e450f419b81b539fb3e9c010fdca40 /src/hash.h | |
parent | 96a0e186d535d761d6b24ef3e929a6710e4b0cea (diff) | |
download | libbu++-32c48edc85e05bedc6324109e8a5429767dda42a.tar.gz libbu++-32c48edc85e05bedc6324109e8a5429767dda42a.tar.bz2 libbu++-32c48edc85e05bedc6324109e8a5429767dda42a.tar.xz libbu++-32c48edc85e05bedc6324109e8a5429767dda42a.zip |
I Fixed the Hash bug!!!
Diffstat (limited to '')
-rw-r--r-- | src/hash.h | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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 | ||