summaryrefslogtreecommitdiff
path: root/ychat-0.7.7.0/src/maps/hash.cpp
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2013-04-06 13:14:41 +0200
committerPaul Buetow <paul@buetow.org>2013-04-06 13:14:41 +0200
commit9cd3ccffd5372dfde3af478e3f832f18db4be3f1 (patch)
tree631c295a4a4a16b57502b847626763a279bf6df7 /ychat-0.7.7.0/src/maps/hash.cpp
parent13aaf70af703748fe096e0664c305cd202637ad2 (diff)
tagging tags
Diffstat (limited to 'ychat-0.7.7.0/src/maps/hash.cpp')
-rw-r--r--ychat-0.7.7.0/src/maps/hash.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/ychat-0.7.7.0/src/maps/hash.cpp b/ychat-0.7.7.0/src/maps/hash.cpp
new file mode 100644
index 0000000..b3d80d1
--- /dev/null
+++ b/ychat-0.7.7.0/src/maps/hash.cpp
@@ -0,0 +1,26 @@
+#ifndef HASH_CPP
+#define HASH_CPP
+
+#include "hash.h"
+
+int
+hash::operator()(string s_key) const
+{
+ int i_hash = 0;
+ // cout << key << "%";
+
+ int i_size = s_key.size();
+
+ for( size_t i = 0; i < i_size; ++i )
+ i_hash = ( i_hash << 5 ) ^ s_key.at(i) ^ i_hash;
+
+ return i_hash;
+}
+
+bool
+hashmap_allocator::operator()(string s_key_1, string s_key_2) const
+{
+ return s_key_1.compare(s_key_2) == 0;
+}
+
+#endif