diff options
author | Mike Buland <eichlan@xagasoft.com> | 2008-09-24 03:22:58 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2008-09-24 03:22:58 +0000 |
commit | 0975d66d2f06603f5e4016440b333aac88e2958a (patch) | |
tree | cd3767fb74c2475fd78bca9ff2d3ba825dd329f4 /src/hash.h | |
parent | 17df4c2b9616c29865b0d893cc797d4938a660a2 (diff) | |
download | libbu++-0975d66d2f06603f5e4016440b333aac88e2958a.tar.gz libbu++-0975d66d2f06603f5e4016440b333aac88e2958a.tar.bz2 libbu++-0975d66d2f06603f5e4016440b333aac88e2958a.tar.xz libbu++-0975d66d2f06603f5e4016440b333aac88e2958a.zip |
Ok, now all the warnings are gone (except for those coming from nids, but that's
ok, nids is still in flux, they'll be gone soon).
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 | ||