diff options
author | Mike Buland <eichlan@xagasoft.com> | 2006-11-21 19:22:12 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2006-11-21 19:22:12 +0000 |
commit | 4e55dab4511ffa8307e3ae7523659e6087632f95 (patch) | |
tree | f053eb86d17113ec9ecedfbd25a07c7044535ae2 | |
parent | 1ef4ff2655e62fad53c4e67476c531c897b7d583 (diff) | |
download | libbu++-4e55dab4511ffa8307e3ae7523659e6087632f95.tar.gz libbu++-4e55dab4511ffa8307e3ae7523659e6087632f95.tar.bz2 libbu++-4e55dab4511ffa8307e3ae7523659e6087632f95.tar.xz libbu++-4e55dab4511ffa8307e3ae7523659e6087632f95.zip |
Added a has function to Hash
Diffstat (limited to '')
-rw-r--r-- | src/hash.h | 9 | ||||
-rw-r--r-- | src/tests/hash.cpp | 2 |
2 files changed, 10 insertions, 1 deletions
@@ -215,6 +215,15 @@ public: | |||
215 | } | 215 | } |
216 | } | 216 | } |
217 | 217 | ||
218 | bool has( key k ) | ||
219 | { | ||
220 | uint32_t hash = __calcHashCode( k ); | ||
221 | bool bFill; | ||
222 | uint32_t nPos = probe( hash, k, bFill ); | ||
223 | |||
224 | return bFill; | ||
225 | } | ||
226 | |||
218 | typedef struct iterator | 227 | typedef struct iterator |
219 | { | 228 | { |
220 | friend class Hash<key, value, sizecalc, keyalloc, valuealloc, challoc>; | 229 | friend class Hash<key, value, sizecalc, keyalloc, valuealloc, challoc>; |
diff --git a/src/tests/hash.cpp b/src/tests/hash.cpp index f9a8f12..a7f0a57 100644 --- a/src/tests/hash.cpp +++ b/src/tests/hash.cpp | |||
@@ -80,7 +80,7 @@ int main() | |||
80 | 80 | ||
81 | for( int j = 0; j < 33; j++ ) | 81 | for( int j = 0; j < 33; j++ ) |
82 | { | 82 | { |
83 | if( sTest[names[j]].isFilled() ) | 83 | if( sTest.has(names[j]) ) |
84 | { | 84 | { |
85 | if( sTest[names[j]] != j ) | 85 | if( sTest[names[j]] != j ) |
86 | { | 86 | { |