aboutsummaryrefslogtreecommitdiff
path: root/src/utfstring.cpp
blob: ae5efaf81a4fb5ccf00e430634b19251127946d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "bu/utfstring.h"

template class Bu::FBasicString<short>;

template<> uint32_t Bu::__calcHashCode<Bu::UtfString>( const Bu::UtfString &k )
{
	long j, sz = k.getSize()*2;
	const char *s = (const char *)k.getStr();

	long nPos = 0;
	for( j = 0; j < sz; j++, s++ )
	{
		nPos = *s + (nPos << 6) + (nPos << 16) - nPos;
	}

	return nPos;	
}

template<> bool Bu::__cmpHashKeys<Bu::UtfString>(
		const Bu::UtfString &a, const Bu::UtfString &b )
{
	return a == b;
}

template<> void Bu::__tracer_format<Bu::UtfString>( const Bu::UtfString &v )
{
	printf("(%ld)\"%s\"", v.getSize(), (const char *)v.getStr() );
}