diff options
Diffstat (limited to 'src/hash.h')
-rw-r--r-- | src/hash.h | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -39,7 +39,7 @@ namespace Bu | |||
39 | 39 | ||
40 | struct __calcNextTSize_fast | 40 | struct __calcNextTSize_fast |
41 | { | 41 | { |
42 | uint32_t operator()( uint32_t nCapacity, uint32_t nFill, uint32_t nDeleted ) const | 42 | uint32_t operator()( uint32_t nCapacity, uint32_t, uint32_t nDeleted ) const |
43 | { | 43 | { |
44 | if( nDeleted >= nCapacity/2 ) | 44 | if( nDeleted >= nCapacity/2 ) |
45 | return nCapacity; | 45 | return nCapacity; |
@@ -506,7 +506,7 @@ namespace Bu | |||
506 | { | 506 | { |
507 | uint32_t hash = __calcHashCode( k ); | 507 | uint32_t hash = __calcHashCode( k ); |
508 | bool bFill; | 508 | bool bFill; |
509 | uint32_t nPos = probe( hash, k, bFill, false ); | 509 | uint32_t nPos = probe( hash, k, bFill ); |
510 | 510 | ||
511 | if( bFill ) | 511 | if( bFill ) |
512 | { | 512 | { |
@@ -533,6 +533,14 @@ namespace Bu | |||
533 | 533 | ||
534 | return bFill; | 534 | return bFill; |
535 | } | 535 | } |
536 | |||
537 | virtual bool has( key k ) const | ||
538 | { | ||
539 | bool bFill; | ||
540 | probe( __calcHashCode( k ), k, bFill ); | ||
541 | |||
542 | return bFill; | ||
543 | } | ||
536 | 544 | ||
537 | /** | 545 | /** |
538 | * Iteration structure for iterating through the hash. | 546 | * Iteration structure for iterating through the hash. |
@@ -979,7 +987,7 @@ namespace Bu | |||
979 | return nCur; | 987 | return nCur; |
980 | } | 988 | } |
981 | 989 | ||
982 | uint32_t probe( uint32_t hash, key k, bool &bFill, bool rehash=true ) const | 990 | uint32_t probe( uint32_t hash, key k, bool &bFill ) const |
983 | { | 991 | { |
984 | uint32_t nCur = hash%nCapacity; | 992 | uint32_t nCur = hash%nCapacity; |
985 | 993 | ||