aboutsummaryrefslogtreecommitdiff
path: root/src/hashfunctionstring.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/hashfunctionstring.cpp51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/hashfunctionstring.cpp b/src/hashfunctionstring.cpp
deleted file mode 100644
index bd14643..0000000
--- a/src/hashfunctionstring.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
1#include "hashfunctionstring.h"
2#ifndef NULL
3#define NULL ((void *) 0)
4#endif
5
6HashFunctionString::HashFunctionString()
7{
8}
9
10HashFunctionString::~HashFunctionString()
11{
12}
13
14unsigned long int HashFunctionString::hash( const void *id )
15{
16 if (id == NULL)
17 {
18 return 0;
19 }
20
21 unsigned long int nPos = 0;
22 for( const char *s = (const char *)id; *s; s++ )
23 {
24 nPos = *s + (nPos << 6) + (nPos << 16) - nPos;
25 }
26 return nPos;
27}
28
29bool HashFunctionString::cmpIDs( const void *id1, const void *id2 )
30{
31 if (id1 == NULL || id2 == NULL)
32 {
33 return false;
34 }
35 if (id1 == id2)
36 {
37 return true;
38 }
39
40 const char *str1 = (const char *)id1;
41 const char *str2 = (const char *)id2;
42
43 int j;
44 for( j = 0; str1[j] != '\0' && str2[j] != '\0'; j++ )
45 {
46 if( str1[j] != str2[j] )
47 return false;
48 }
49 return (str1[j]==str2[j]);
50}
51