aboutsummaryrefslogtreecommitdiff
path: root/src/utfstring.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/utfstring.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/utfstring.cpp b/src/utfstring.cpp
new file mode 100644
index 0000000..ae5efaf
--- /dev/null
+++ b/src/utfstring.cpp
@@ -0,0 +1,29 @@
1#include "bu/utfstring.h"
2
3template class Bu::FBasicString<short>;
4
5template<> uint32_t Bu::__calcHashCode<Bu::UtfString>( const Bu::UtfString &k )
6{
7 long j, sz = k.getSize()*2;
8 const char *s = (const char *)k.getStr();
9
10 long nPos = 0;
11 for( j = 0; j < sz; j++, s++ )
12 {
13 nPos = *s + (nPos << 6) + (nPos << 16) - nPos;
14 }
15
16 return nPos;
17}
18
19template<> bool Bu::__cmpHashKeys<Bu::UtfString>(
20 const Bu::UtfString &a, const Bu::UtfString &b )
21{
22 return a == b;
23}
24
25template<> void Bu::__tracer_format<Bu::UtfString>( const Bu::UtfString &v )
26{
27 printf("(%ld)\"%s\"", v.getSize(), (const char *)v.getStr() );
28}
29